Automating EC2 Instance Creation with AWS CLI Script – A Step-by-Step Guide

Autopublished from RSS Original article

Here is an AWS CLI script that creates an EC2 instance with a subnet in the “us-east-1a” availability zone, in a security group, and with an Ubuntu 20.04 t2.small instance type:

aws ec2 run-instances
--image-id ami-0c55b159cbfafe1f0
--instance-type t2.small
--key-name MyKeyPair
--security-group-ids sg-49d61617
--subnet-id subnet-049df61146f127901
--placement "AvailabilityZone=us-east-1a" \