Create EC2 instance

Create Security Groups (SG) for ALB and EC2

First, we create SG for ALB:

  1. Access EC2 service management interface
  • Select Security Groups.
  • Select Create security groups.

ConnectPrivate

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

ConnectPrivate

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

ConnectPrivate

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.

ConnectPrivate

Create EC2 Server:

  1. Access EC2 service management interface
  • Select Instances.
  • Select Launch instances.

ConnectPrivate

  1. 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.

ConnectPrivate

  • 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.

ConnectPrivate

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

ConnectPrivate

  • 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.

ConnectPrivate