AWS Certified Advanced Networking - Specialty Exam: Understanding Subnets and EC2 Instances

Understanding Subnets and EC2 Instances

Prev Question Next Question

Question

A user has created a subnet in VPC and launched an EC2 instance within it and is trying to access the instance through internet.

The user has not selected the option to assign the IP address while launching the instance.

Which of the below mentioned statements is true with respect to this scenario?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - D.

When you create a simple subnet and VPC , there is no internet gateway attached to the VPC.

So to access it from the internet you need to ensure an Internet gateway is attached to the VPC and an elastic or public IP is assigned to the EC2 instance.

For more information on VPC and subnets , please visit the URL:

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario1.html

When launching an EC2 instance in a subnet within a VPC, the user has the option to assign the instance a public IP address. If the user chooses not to assign a public IP address while launching the instance, the following applies:

A. The instance will not always have a public DNS attached to the instance by default. By default, the instance will be assigned a private IP address, and no public DNS name will be associated with it. However, if the instance is launched in a subnet with a Route 53 Resolver Endpoint, then the instance may receive a private DNS name.

B. The user can directly attach an Elastic IP address to the instance. Elastic IP addresses provide a static, public IP address that can be associated with an instance even if it is stopped or started. Elastic IP addresses are not assigned by default, but they can be allocated and associated with an instance at any time, even after the instance has been launched.

C. The instance will launch successfully even if a public IP address is not assigned. By default, the instance will be assigned a private IP address, which allows it to communicate with other instances in the same subnet or VPC. However, the instance will not be accessible from the internet unless a public IP address or Elastic IP address is assigned and associated with the instance.

D. To allow the instance to connect to the internet, the user would need to create an internet gateway and then attach an Elastic IP address to the instance. An internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between instances in the VPC and the internet. An Elastic IP address can be allocated and associated with an instance, and then the instance can communicate with the internet through the internet gateway.

Therefore, the correct answer is (D): The user would need to create an internet gateway and then attach an elastic IP to the instance to connect from the internet.