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

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" \
ALSO READ  Which cloud platform will have the highest demand for skilled professionals?

Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *