Question: Please, provide the AWS CLI command to create ec2 instances on the subnets for the following: for public subnet, private subnet, and users on the

Please, provide the AWS CLI command to create ec2 instances on the subnets for the following: for public subnet, private subnet, and users on the Internet.

Please do the ping tests to test the requirement successfully.

Note:

I launched an EC2 instance into the VPC via: aws ec2 run-instances --image-id ami-xxxxxxxxxx --count 1 --instance-type t3.micro --key-name username-key --security-group-ids sg-xxxxxxxxxx --subnet-id subnet-xxxxxxxxxxxxx --associate-public-ip-address

--associate-public-ip-address can help to get the ping test correctly, but I am not sure how to create ec2 instance for each subnets and how to get the ping tests correctly.

For the private subnet: When I used aws ec2 run-instances --image-id ami-xxxxxxxxxx --count 1 --instance-type t3.micro --key-name username-key --security-group-ids sg-xxxxxxxxxx --subnet-id subnet-xxxxxxxxxxxxx, I found the instance id, the private id, and log in to ssh using the public ip address. When I did the ping tests, the private id ping works and public ping did work which I think it is correct however ping www.google.com works which I think it should not work for any host on the Internet.

Please, help me to answer my questions! Thank You!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!