事实证明,放置ssh键以便被git在EB上拾取的正确位置是
/root/.ssh,不是
/tmp/.ssh, 不是
/home/ec2-user/.ssh。
我的最终配置(假设在的S3存储桶中有一个私有SSH密钥
<my-bucket>/github-eb-key,并且使用访问权限访问该仓库的github用户注册了相应的公共密钥),使用配置为的AMI
64bit Amazon Linux 2016.09v3.3.0 running Node.js,并且在AMI中配置了以下内容
.ebextensions/01_ssh_setup.config:
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: s3files: /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



