Skip to content

Instantly share code, notes, and snippets.

@rohang07
Created March 19, 2016 11:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rohang07/fdf1d1caf0048968424d to your computer and use it in GitHub Desktop.
Save rohang07/fdf1d1caf0048968424d to your computer and use it in GitHub Desktop.
eb extension for pulling ssh config from s3
---
Resources:
AWSEBAutoScalingGroup:
Metadata:
? "AWS::CloudFormation::Authentication"
:
S3Auth:
buckets:
- bucket-name
roleName:
? "Fn::GetOptionSetting"
:
DefaultValue: aws-elasticbeanstalk-ec2-role
Namespace: "aws:asg:launchconfiguration"
OptionName: IamInstanceProfile
type: s3
files:
/tmp/.ssh/deploy_key:
authentication: S3Auth
mode: "000600"
owner: ec2-user
source: "S3-file-URL"
/tmp/.ssh/config:
authentication: S3Auth
mode: "000600"
owner: ec2-user
source: "S3-file-URL"
@rohang07
Copy link
Author

Elastic beanstalk runs npm install as the user 'nodejs' with home directory /tmp.
The ssh config needs to be in the /tmp/.ssh folder

@rohang07
Copy link
Author

This will overwrite /tmp/.ssh/config - you shouldn't really be depending on a config file in /tmp anyway, but a workaround would be getting the file and concatenating in the existing file using ebextensions 'commands'

@pulekies
Copy link

pulekies commented Aug 1, 2017

I ran into this issue and found the following solution: https://stackoverflow.com/questions/43497663/setting-up-ssh-keys-for-github-private-repo-access-on-elastic-beanstalk

That thread suggests that /tmp/.ssh/ should be /root/.ssh/. Have you run into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment