Create EC2 instance
Create Security Groups (SG) for ALB and EC2
First, we create SG for ALB:
- Access EC2 service management interface
- Select Security Groups.
- Select Create security groups.

- On the Step 1 page
- Fill in the security group name, description and VPC information for the security group.

- Configure Inbound rules: allow all connections to ALB.
- Configure Outbound rules: allow connections out of ALB by default.
- Select create SG.

Next, we create SG for EC2 similar to ALB:
- Configure Inbound rules: allow all connections from ALB to EC2.
- Configure Outbound rules: allow connections to EC2 by default.
- Select to create SG.

Create EC2 Server:
- Access EC2 service management interface
- Select Instances.
- Select Launch instances.

- On the Step 1 page
- Enter the name of the EC2 to create.
- Select Amazon Machine Image as Amazon Linux 2 AMI
- Select Instance type as t2.micro.

- In the Key pair section, select Create new key pair.
- Fill in the name, type (RSA) and format.
- Save the key pair in the project folder on your computer.

- Select the newly created keypair.
- Select Edit in the Network settings section to configure the network for EC2

- Select VPC as the newly created VPC.
- Select Subnet as private subnet 1.
- Select Auto-assign public IP: disable (because EC2 is in private subnet, auto-assign public IPv4 address has not been enabled)
- In Firewall, select the security group just created above for EC2.
- In Configure storage, leave the default 8 GiB gp2 for Root volume.
- Review the settings again, select Launch instance to initialize.
