Analogue.cloud recently organized an AWS Hands-on Workshop for students Applied Informatics at the PXL-IT school in Hasselt. During this 3 hour session the students were introduced into the wonderful world of AWS. After some introductory slides the participants were invited to work in a real AWS environment. The students learned to setup a website that can easily be copied and deployed in different environment. They also had to establish a serverless rest call service using the AWS Lambda. During the workshop the participants played with EC2, S3, Cloudformation, Cloudfront, API Gateway and Lambda.
For those interested, you can find more information about the exercises below:
To start off the lab:
Log in to the AWS console with the provided credentials: https://euwest1.console.aws.amazon.com/console/home?region=eu-west-1
Select the EU Ireland region (eu-west-1) at the right top side of your screen.
In case of Windows users: Download Putty and PuttyGen
Choose a hypothetical website/app name.
Ex 1 Obligatory webserver:
1. Go to the ec2 service in the main screen.
2. Go to key pairs in the left side bar and make a key pair called your appname so we can use it to log into the servers we create. (Download it)
3. Make 2 security groups.
a. <appname>-Outside-acc allows access to port 80 from everywhere.
b. <appname>-internal-acc should allow access on
i. port 22 from your IP (https://www.whatismyip.com/)
ii. allow access to port 80 from the security group outside-acc
4. Start an ec2 instance with 10 GB root disk that runs the start.sh script on startup.
a. Give this instance the security group internal-acc
5. The ec2 instance needs to be error proof so we should put it behind an Auto Scaling Group (ASG) so if the server goes down a new one is spun back up.
6. We should have a target group to check if the webserver is still serving requests with a health check.
7. If we ever get enough load we could easily spin up more servers with the ASG so we will need an Application Load Balancer (ALB) to distribute the incoming requests.
a. Give this ALB the security group <appname>-outside-acc.
8. Link the ASG with the TG and put the health check on ELB, then kill the instance to test if the Auto Scaling is doing its job.
Details for the EC2 instance:
Instance size: t2.micro
AMI-ID: quick start Red Hat Enterprise Linux 7.5
Root disk size: 8gb
Goal Of exercise 1:
1. When surfing to the Load Balancer DNS, you should get a Hello World page.
2. When logging in to the EC2 instance, with the key value pair that we created earlier and the user, you can stop the service (sudo service httpd stop).
Due to the server being stopped, the instance should terminate and a new instance will spawn.
3. The website will be scalable, this means that the ASG will provide more instances when there is a high work load
Documentation of exercise 1:
Ex 2 The GOTCHA:
1. First of you should delete the EC2, SG, ASG, TG, ALB from ex 1 but leave the key pair.
2. Navigate to the CloudFormation and create a new stack.
a. Upload the CF-Hello_world template provided with the exercises in S3.
3. Give it the ALL the parameters and create the stack.
4. While it is being created you can have a look in the template itself, everything is code :)
Goal of exercise 2:
1. Have a website that can easily be copied and deployed in different environments.
Documentation of exercise 2:
Ex 3 the user AWS services:
1. Navigate to the S3 service.
2. Create and s3 bucket name it after your <appname>.
a. When creating the S3 bucket be sure to use a unique name for the bucket.
b. Make sure to choose the Ireland region
3. Use the UI to upload a basic Hello World html file into the bucket
a. Set the permissions of the file to public
4. Navigate to the CloudFront service
5. Create a new CloudFront web distribution
a. Use the S3 bucket as origin
b. Restrict the endpoints to US, Europe & Canada
6. Move on to exercise 4 while the CloudFront is being deployed. THIS CAN TAKE 20 TO 30 MINUTES
Goal of exercise 3:
1. Have a static webpage hosted for you
Documentation of exercise 3:
Ex 4 AWS Lambda:
1. Create a simple lambda function to return hello world. (Look at the get started doc)
2. Create a new API Gateway deployment
3. In this API GW select the root direct
a. Click on actions & create a new GET method
4. Point this get method to your lambda without using proxy integration.
5. Select the root directory, actions, Deploy the method and surf to the end point that was just created.
Goal of exercise 4:
1. Have a serverless rest call service
Documentation of exercise 4: