Created
April 20, 2017 06:01
-
-
Save henhal/782dac50ba53ae164af0e95a41108af5 to your computer and use it in GitHub Desktop.
Transferring SSH keys to Elastic Beanstalk in order to access private gits (for npm etc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resources: | |
AWSEBAutoScalingGroup: | |
Metadata: | |
? "AWS::CloudFormation::Authentication" | |
: | |
S3Auth: | |
buckets: | |
- <my-bucket> | |
roleName: | |
? "Fn::GetOptionSetting" | |
: | |
DefaultValue: aws-elasticbeanstalk-ec2-role | |
Namespace: "aws:asg:launchconfiguration" | |
OptionName: IamInstanceProfile | |
type: s3 | |
files: | |
/root/.ssh/github-eb-key: | |
authentication: S3Auth | |
mode: "000600" | |
owner: root | |
group: root | |
source: "https://s3-eu-west-1.amazonaws.com/<my-bucket>/github-eb-key" | |
/root/.ssh/config: | |
mode: "000600" | |
owner: root | |
group: root | |
content: | | |
Host github.com | |
IdentityFile /root/.ssh/github-eb-key | |
IdentitiesOnly yes | |
UserKnownHostsFile=/dev/null | |
StrictHostKeyChecking no |
@henhal is this still working with container_command? it looks here like its not finding the key
@tobsn I'm sorry but it's been a year and a half since I last used Elastic Beanstalk so I don't know if it's still valid. I do know that I used this in combination with other config files making use of container_commands
though, so I have no reason to believe it wouldn't still work.
@henhal yeah it somehow started working... must have been the mode settings, idk... :D
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this in .ebextensions, your EB will fetch a SSH private key from S3 at /github-eb-key. Very useful if your EB needs to source repositories from git, or other places requiring authentication through SSH keys, for example if using NPM with private repositories sourced through github.