You launch an EC2 instance but do not specify any security group. What is the default behavior regarding network access?
Think about what AWS does automatically if you don't specify a security group.
If you don't specify a security group, AWS assigns the default security group of the VPC to the instance. This group allows inbound traffic only from other instances in the same group and allows all outbound traffic.
You want to launch an EC2 instance and automatically install Apache web server using user data. Which user data script is correctly formatted for Amazon Linux 2?
Amazon Linux 2 uses yum and systemctl commands. The script must start with a shebang line.
The correct user data script starts with #!/bin/bash and uses yum to install Apache, then uses systemctl to start and enable the service. Option B matches this exactly.
Choose the correct architecture to meet these requirements:
- EC2 instance accessible only from your office IP address.
- Instance can access the internet to download updates.
- Instance is in a private subnet.
Think about how instances in private subnets access the internet and how to restrict inbound access.
Instances in private subnets cannot access the internet directly. A NAT Gateway in a public subnet allows outbound internet access. Security groups restrict inbound traffic. Option A meets all requirements.
You launch an EC2 instance and assign it an IAM role with permissions to read objects from S3 buckets. What is the expected behavior?
Consider how IAM roles provide permissions to EC2 instances.
IAM roles assigned to EC2 instances provide temporary credentials automatically. This allows the instance to access AWS services like S3 according to the role's permissions without manual credential management.
You want to deploy a web application on EC2 instances with high availability and fault tolerance. Which setup follows AWS best practices?
Think about distributing load and handling failures automatically.
Using multiple instances across Availability Zones with a load balancer and Auto Scaling ensures the application remains available if one instance or zone fails and can handle traffic changes automatically.