Add a couple of AWS questions and exercises

EBS & ELB mainly.
This commit is contained in:
abregman
2021-11-20 22:59:23 +02:00
parent c93d394d9b
commit 899c510e76
9 changed files with 316 additions and 31 deletions

View File

@ -0,0 +1,44 @@
## AWS ELB - ALB Multiple Target Groups
### Requirements
Two EC2 instances with a simple web application that shows the web page with the string "Hey, it's a me, `<HOSTNAME>`!"
One EC2 instance with a simple web application that shows the web page with the string "Hey, it's only a test..." under the endpoint /test
### Objectives
1. Create an application load balancer for the two instances you have, with the following properties
1. healthy threshold: 3
2. unhealthy threshold: 3
3. interval: 10 seconds
2. Create another target group
1. Traffic should be forwarded to this group based on the "/test" path
### Solution
#### Console
1. Go to EC2 service
2. Click in the left side menu on "Load balancers" under "Load balancing"
3. Click on "Create load balancer"
4. Choose "Application Load Balancer"
5. Insert a name for the LB
6. Choose an AZ where you want the LB to operate
7. Choose a security group
8. Under "Listeners and routing" click on "Create target group" and choose "Instances"
1. Provide a name for the target group
2. Set healthy threshold to 3
3. Set unhealthy threshold to 3
4. Set interval to 10 seconds
5. Click on "Next" and choose two out of three instances you've created
6. Click on "Create target group"
9. Refresh target groups and choose the one you've just created
10. Click on "Create load balancer" and wait for it to be provisioned
11. In the left side menu click on "Target Groups" under "Load Balancing"
12. Click on "Create target group"
13. Set it with the same properties as previous target group but this time, add the third instance that you didn't include in the previous target group
14. Go back to your ALB and under "Listeners" click on "Edit rules" under your current listener
1. Add a rule where if the path is "/test" then traffic should be forwarded to the second target group you've created
2. Click on "Save"
15. Test it by going to the browser, insert the address and add "/test" to the address

View File

@ -0,0 +1,35 @@
## AWS ELB - Application Load Balancer
### Requirements
Two EC2 instances with a simple web application that shows the web page with the string "Hey, it's a me, `<HOSTNAME>`!"
### Objectives
1. Create an application load balancer for the two instances you have, with the following properties
1. healthy threshold: 3
2. unhealthy threshold: 3
3. interval: 10 seconds
2. Verify load balancer is working (= you get reply from both instances at different times)
### Solution
#### Console
1. Go to EC2 service
2. Click in the left side menu on "Load balancers" under "Load balancing"
3. Click on "Create load balancer"
4. Choose "Application Load Balancer"
5. Insert a name for the LB
6. Choose an AZ where you want the LB to operate
7. Choose a security group
8. Under "Listeners and routing" click on "Create target group" and choose "Instances"
1. Provide a name for the target group
2. Set healthy threshold to 3
3. Set unhealthy threshold to 3
4. Set interval to 10 seconds
5. Click on "Next" and choose the two of the instances you've created
6. Click on "Create target group"
9. Refresh target groups and choose the one you've just created
10. Click on "Create load balancer" and wait for it to be provisioned
11. Copy DNS address and paste it in the browser. If you refresh, you should see different message based on the instance where the traffic was routed to

View File

@ -0,0 +1,27 @@
## AWS - Create EFS
### Requirements
Two EC2 instances in different availability zones
### Objectives
1. Create an EFS with the following properties
1. Set lifecycle management to 60 days
2. The mode should match a use case of scaling to high levels of throughput and I/O operations per second
2. Mount the EFS in both of your EC2 instances
### Solution
1. Go to EFS console
2. Click on "Create file system"
3. Create on "customize"
1. Set lifecycle management to "60 days since last access"
2. Set Performance mode to "MAX I/O" due to the requirement of "Scaling to high levels of throughput"
3. Click on "Next"
4. Choose security group to attach (if you don't have any, create one and make sure it has a rule to allow NFS traffic) and click on "Next" until you are able to review and create it
5. SSH into your EC2 instances
1. Run `sudo yum install -y amazon-efs-utils`
2. Run `mkdir efs`
3. If you go to your EFS page and click on "Attach", you can see what ways are there to mount your EFS on your instancess
1. The command to mount the EFS should be similar to `sudo mount -t efs -o tls <EFS name>:/ efs` - copy and paste it in your ec2 instance's OS