Bootstrap AWS ec2 with CloudFormation and Docker
The host is requried to have docker installed. This can be done
with UserData
either through cloud-init
or a shell script.
Once docker is available this image can be run with:
docker run \
-v /var/run/docker.sock:/var/run/docker.sock
-e [AWS_DEFAULT_REGION=] -e [CFN_METADATA_RESOURCE=] -e ...
sungardas/aws-cfn-bootstrap
The container will interface with CloudFormation, can access
CloudFormation Metadata and is able to respond to a CreationPolicy
or
WaitCondition
.
Useful for implementations that only run Docker containers and for minimal operating systems like rancheros
AWS::CloudFormation::Init
can contain run docker
which is linked
to the host. Images will be pulled and run by the host docker engine.
This project creates tags for different versions of docker. Use a tag that matches the version of docker the host is running.
sungardas/aws-cfn-bootstrap:1.9
sungardas/aws-cfn-bootstrap:1.10
sungardas/aws-cfn-bootstrap:1.11
sungardas/aws-cfn-bootstrap:1.12
The image contians the latest cfn-bootstrap scripts, the ec2-metadata query tool and the aws cli.
AWS_DEFAULT_REGION
- The AWS region to run against.
CFN_CONFIG_SETS
- List of config sets to run.
CFN_METADATA_RESOURCE
- The resource containing AWS::CloudFormation::Init
CFN_NOTIFY_RESOURCE
- The resource to send notification to when
complete. Usually one with CreationPolicy
defined.
CFN_STACK_NAME
- The name of the CloudFormation Stack
ECR_REGISTRY_IDS
- If set, will run aws ecr get-login
and populate
the host docker engine with credentials for ECR. Recommened to use with
an ec2 instance profile.
Inspired by docker-aws
Apache-2.0 ©
This project is maintained by the Labs team at Sungard Availability Services
GitHub: https://sungardas.github.io