AMI-Baker is a tool to create a Core OS based AMI which runs a docker based application.
AWS access is required in order to create an AMI. As we use packer, packer has four methods of providing AWS credentials (more details at https://www.packer.io/docs/builders/amazon.html#_aws_credentials).
You can use the method that requires environmental variables to be set up or the one which requires a ~/.aws/credentials
file to be present, or run it on an EC2 instance which has an IAM role attached which is allowed to create instances, snapshots and AMIs.
Please refer to the given link for details.
To build your Core OS based AMI, you need to run the script bake-ami.sh
.
The parameters for the script are as follows:
The AWS region in which the AMI is to be created.
The name of the AMI to be created.
Name of the docker image of your application which will be used to create a systemd unit, in order to run your application on Core OS.
Docker options used with the docker run command in order to run your application.
Instance type to be specified in the AMI, it defaults to t2.medium
The VPC in which packer will create a base instance in order to create an AMI. Specify if you do not want to use default VPC.
The subnet in which packer will create a base instance in order to create an AMI. Specify if you do not want to use default VPC.
Complete path to folder where docker registry certificates are placed.
It will usually be like /etc/docker/certs.d/<registry-host>:<registry-port>
Example:
./bake-ami.sh -r us-east-1 -n myAmi -d hello-world