Professional Documents
Culture Documents
Create subnet with 10.0.0.0/24 CIDR block using VPC ID from the previous step
#aws ec2 create-subnet --vpc-id $VpcId --cidr-block 10.0.0.0/24
Output returns a SubnetId
Before launching an instance, you are required to create a security group in your
VPC
Adding a rule that allows SSH access from anywhere with the GroupId
#aws ec2 authorize-security-group-ingress --group-id $GroupId --protocol tcp --port
22 --cidr 0.0.0.0/0
Launch an instance with ImageId into your subnet using GroupId, KeyPair, and
SubnetId.
#aws ec2 run-instances --image-id $ImageId --count 1 --instance-type t2.micro
--key-name $KeyPair --security-group-ids $GroupId --subnet-id $SubnetId
Output returns an InstanceId