- Refer to AWS CloudShell
wget https://github.com/t2yijaeho/Custom-AMI-EC2-with-CloudFormation/raw/matia/Template/EC2-MigVM.yaml- For Spot instance
wget https://github.com/t2yijaeho/Custom-AMI-EC2-with-CloudFormation/raw/matia/Template/EC2-MigSpot.yaml-
Change
<My Custom Image ID>to your Custom Amazon Machine Image ID -
Change
<My IP>to your local machine IP address (ParameterValue must be in CIDR block)
aws cloudformation create-stack \
--stack-name MigrationVM \
--template-body file://./EC2-MigVM.yaml \
--parameters ParameterKey=CustomImageID,ParameterValue="<My Custom Image ID>" \
ParameterKey=LocalLocation,ParameterValue="<My IP>/32"aws cloudformation create-stack \
--stack-name MigrationVM \
--template-body file://./EC2-MigSpot.yaml \
--parameters ParameterKey=CustomImageID,ParameterValue="<My Custom Image ID>" \
ParameterKey=LocalLocation,ParameterValue="<My IP>/32"{
"StackId": "arn:aws:cloudformation:us-abcd-x:123456789012:stack/MigrationVM/b4d0f5e0-d4c2-11ec-9529-06edcc65f112"
}