4

AWS: Passing private configuration to a Docker container (via S3)

 2 years ago
source link: https://blog.jakubholy.net/2015/07/29/aws-passing-private-configuration-to-a-docker-container-via-s3/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

AWS: Passing private configuration to a Docker container (via S3)

July 29, 2015
Philipp Garbe describes how to pass environment variables that you want to keep private to a public Docker instance run on Amazon Web Services (beanstalk or ECS) in his post How to Run HuBot in Docker on AWS EC2 Container Services - Part 3. The trick is:
  1. Put them into an env.sh file that you can source on S3 (and allow the appropriate EC2 IAM role to access it)
  2. As a part of your startup CMD, run aws s3 cp to fetch and then source it
Here is his example of the CMD from a Dockerfile:

CMD ["/bin/sh", "-c", "aws s3 cp --region eu-west-1 s3://your-bucket/env.sh .; . ./env.sh; bin/hubot --adapter slack"]


See the full source code in his GitHub repo. Thanks for sharing, Phillipp!
Tags: DevOps

Are you benefitting from my writing? Consider buying me a coffee or supporting my work via GitHub Sponsors. Thank you! You can also book me for a mentoring / pair-programming session via Codementor or (cheaper) email.

Allow me to write to you!

Let's get in touch! I will occasionally send you a short email with a few links to interesting stuff I found and with summaries of my new blog posts. Max 1-2 emails per month. I read and answer to all replies.

Copyright © 2022 Jakub Holý
Powered by Cryogen
Theme by KingMob

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK