Note: this file only contains notes about the labs. For the theory, check the here.
We can interact with AWS using:
- AWS Management Console - remember to select the region;
- AWS CLI - a unified tool to manage your AWS services;
- Useful to create scripts to automate tasks;
- AWS SDKs - for programming languages like Python, Java, Ruby, etc.
- We will use the Java SDK in the labs.
- Choose name, OS, AMI and architecture;
- Select the instance type (e.g., t2.micro);
- Create a key pair (
.pem
file) - used to connect to the instance; - Configure the security group (firewall rules) - you can create a new one or use an existing one;
- In Advanced Details, you can enable Detailed Monitoring (CloudWatch).
Now you can launch the instance and connect to it using SSH:
ssh -i "key.pem" ec2-user@<public-ip>
- Using the instance you created, install the necessary software;
- Create an AMI from the instance, selecting a name.
- Create a Classic Load Balancer;
- Select a name and the availability zones;
- Select the security group;
- Configure the health check.
- Create a Launch Template;
- Select the name and the AMI you created;
- Select the instance type and the key pair;
- Configure the security group.
- Create an Auto Scaling Group;
- Give it a name and select the launch template you created;
- Select the availability zones -
⚠️ must be the same as the load balancer; - In the Advanced options, Attach to an existing load balancer, and choose the one you created;
- Configure the health checks (Turn on Elastic Balancing health checks, grace period of 60s, and enable CloudWatch at the additional settings);
- Configure the desired capacity and the minimum and maximum size;
- Configure the scaling policies (you can create CloudWatch alarms and attach them to the scaling policies).