Skip to content

Instantly share code, notes, and snippets.

@jaygiang
Last active June 27, 2018 23:37
Show Gist options
  • Save jaygiang/ff50778bc73c4363268ac2c02ffe5e3a to your computer and use it in GitHub Desktop.
Save jaygiang/ff50778bc73c4363268ac2c02ffe5e3a to your computer and use it in GitHub Desktop.

EC2 Lab

Intro: You are an engineer for a CloudServices Inc. A client needs a new web server configured to host their application form.

Task: You are to use your knowledge of EC2 to create a highly scalable/available web server for the client with the following specs:

Region: US-West-2
AMI: Amazon Linux AMI
Instance Type: T2 Micro
Number of instances: 1
Network: VPC default
Enable termination protection: On
Monitoring: On
Storage: General Purpose SSD
Tags: Key = Server Value = Application server
Security Group: Create new called app-server with appropriate description
Network Protocols: SSH port 20 from your IP address only, HTTP port 80 from any source, HTTPS port 443 from any source.

Note: You will have to create a new key-pair and download prior to launching your instance. Save the key-pair on your computer. You will use this to SSH into your EC2 instance.

Testing: You must prove that you can SSH into your EC2 instance from your local machine. Show instructor when you have SSH into your instance before proceeding.

  • Open terminal, navigate to folder contain key-pair you download. The file ends with a .pem format.
  • Chmod 400 key-pair-name.pem
  • SSH into EC2 instance

Config EC2 instance: While connected to your instance, perform the following actions on your instance. You will be making the instance into a web server that runs apache.

  • Change user to root
  • Yum update -y
  • Yum install httpd -y
  • Service httpd start

Build Application Form: You will now use HTML to build a basic application form for the client. It must have the following attributes:

  • Navigate to /var/www/html

  • Create a index.html file using nano. This is where you will build the application form.

  • When done, navigate to instances public IP address and you should see your application form.

  • Must show instructor application form before moving on.

    • First Name
    • Last Name
    • Email
    • Phone
    • Address
    • Zip
    • State
    • Submit Button

Availability: Your client needs the application server to be hosted in many different regions to reduce latency for users in other countries. Perform the following on your existing instance.

  • Stop the instance and make a snapshot of it.
  • Copy the snapshot to Asia Pacific(sydney)
  • Launch identical EC2 instance in Sydney.
  • You should see the same application form you built in US-West-2
  • Show instructor your running web server in Sydney.

Clean Up:

  • In each region US-west-2 and Asia Pacific(Sydney) delete the snapshot.
  • In each region, detach the volume of the EC2 instance.
  • In each region, delete the volume.
  • In each region, delete the EC2 instance.
  • In each region, remove the security group that you created.
  • Verify you have no more snapshots, volumes, security groups, or EC2 instances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment