CD with AWS Elastic Beanstalk: Storing & transferring credentials

From build machine we’ll use AWS, BitBucket and DockerHub and I want to automate auth process.

I can place login procedure to script, but I don’t want to store any keys in scripts.
So let’s create folder called “secret” to which we’ll place files with credentials.
This folder can be placed in Git repo or it can be transferred to build machine using SFTP.

Now we need to generate files with credentials for:
1. BitBucket
2. AWS
3. DockerHub
4. ssmtp (email)
5. mongoDB

1. BitBucket – we’ll use Deployment key:

Screen Shot 2016-01-12 at 12.21.44

 

2. AWS – we’ll sign in from cli on local machine and copy ~/.aws/credentials  file to “secret” folder:

Screen Shot 2016-01-12 at 12.21.00

 

Please remember that AWS account must have AWSElasticBeanstalkFullAccess permissions.

 

3. DockerHub – we’ll sign in from cli on local machine and copy content of ~/.docker/config.json to ~/dockerconfig.
We need to remove auths block from ~/dockerconfig:

Screen Shot 2016-01-12 at 12.39.17

 

Than we need to create new S3 bucket in the same region as EBS will be deployed in and upload dockerconfig file to this bucket:

Screen Shot 2016-01-12 at 12.42.28

 

Finally, we need to copy ~/.docker/config.json file to “secret” folder:

Screen Shot 2016-01-12 at 12.46.44

 

4. SSMTP – We’ll create ssmtp.conf file with credentials:

Screen Shot 2016-03-04 at 11.44.21

 

5. MongoDB – we’ll store credentials in mongoConnStr file:

Screen Shot 2016-03-04 at 11.47.17

 

That’s all about credentials story, so let’s move forward to “build machine”.

CD with  AWS Elastic Beanstalk table of contents