AWS do AMI (aws-do-ami) -
Create and manage your Amazon Machine Images (AMI) using the do-framework
Amazon Machine Images (AMI) are machine images that contain the information required to launch EC2 instances. This project builds a container that is equipped with HashiCorp Packer, other tools and utility scripts that help with building and management of Amazon Machine Images. Example AMI recipes as well as references to other related projects are provided. The goal of this project is to make building and management of Amazon Machine Images easy by following the principles of the do-framework.
- Git - needed to clone this project
- Docker - needed to build and run the project
- AWS CLI Credentials - needed to access AWS APIs
Execute ./build.sh
to build the aws-do-ami
container image.
Execute ./run.sh
to start the aws-do-ami
container.
The ./status.sh
script shows the current state of the aws-do-ami
container.
Run the ./exec.sh
script to open a shell in the aws-do-ami
container. All tools, the packer
cli, and utility scripts are available in the /ami directory.
ami-create.sh [name]
- create an ami from the packer reciple in folder/wd/packer/<name>
ami-delete.sh <AMI_ID>
- deregister specified ami from accountami-dir.sh
- list local packer-based ami recipesami-list.sh
- list ami's owned by the current AWS accountaws-config.sh
- configure aws clientec2-launch.sh
- launch an EC2 instance from ami as configured inwd/conf/ec2.conf
ec2-list.sh
- list all EC2 instances in the configured account and regionec2-profiles.sh
- list available instance profilesec2-start.sh <instance_id>
- start a stopped EC2 instanceec2-stop.sh <instance_id>
- stop a running EC2 instanceec2-terminate.sh <instance_id>
- terminate the specified EC2 instancekeypair-create.sh [KEYPAIR_NAME]
- create ssh key pair with specified namekeypair-delete.sh [KAYPAIR_NAME]
- delete the specified key pairkeypair-list.sh
- list available ssh key pairspacker-dir.sh
- list local packer-based ami recipes in tree formatproject-dir.sh
- list in tree format well-known other projects for building ami'ssg-create.sh
- create a security group and allow SSH access from the current IP addresssg-delete.sh <sg_id>
- delete the specified security groupsg-list.sh
- list available security groupsstack-delete.sh <stack_name>
- delete cloud formation stack by namestack-list.sh
- list completed cloud formation stacksvpc-list.sh
- list current VPCs in the regionvpc-subnets.sh <vpc_id>
- list subnets belonging to the specified vpc
Execute the ./stop.sh
script to stop and remove the aws-do-ami
container.
As previously described, this project builds a container that is equipped with tools needed for creating AMI's on AWS. It includes a library of AMI recipes and references to other projects for building AMI's, all useable within the container. A typical workflow is described below:
- Clone the project
git clone https://github.com/aws-samples/aws-do-ami
cd aws-do-ami
- Build the
aws-do-ami
container image
./build.sh
- Run the
aws-do-ami
container
./run.sh
- Open a shell into the container
./exec.sh
- Configure AWS credentials
./aws-config.sh
- List available AMI recipes
./packer-dir.sh
Advanced users may customize the existing or create their own ami recipes in the working directory wd/packer
.
- Build selected AMI by recipe name
./ami-create.sh <ami_recipe_name>
- Repeat steps 6 and 7 as needed
Alternatively, other well-known projects for building AMIs can be cloned and used within the aws-do-ami
container.
You may list these projects in place of step 6 by using the ./project-dir.sh
command. To select one of the projects, change your current directory cd project/<path>
, then run the corresponding clone-
script.
Example:
./project-dir.sh
project
└── github.com
├── aws-samples
│ └── awsome-distributed-training
├── awslabs
│ └── amazon-eks-ami
└── clowdhaus
└── amazon-eks-gpu-ami
cd project/github.com/aws-eks-ami
./clone-aws-eks-ami.sh
Refer to the README of your selected project for instructions about building AMIs. The tools needed by the project should already be included in the aws-do-ami
container. Advanced users may customize these projects or add new ones. If any new tools are needed, they can be added to the setup.sh
script of the aws-do-ami
project. Changes to this script take effect after the container is built using ./build.sh
and restarted using ./stop.sh
and ./run.sh
.
See CONTRIBUTING for more information.
This project is licensed under the MIT-0 License. See the LICENSE file.