AWS代写:CSE383 EC2

练习在AWSEC2上搭建Web服务器。

EC2

Objective

The objective of this exercise is to:

  1. Configure web server in cloud
  2. Create and understand Rest Servers
  3. Understand and create cloud based backups

Part #1: Set up static IP (Elastic IP)

Exercise

  1. Shut down your ec2 instance if it is running
    • a. Go to the Ec2 dashboard
    • b. Select the instance
    • c. Select the drop down for instance state to “Stop Instance”
  2. Write down the availability zone of your instance in the dashboard
    • a. Mine is us-east-1a for example (use yours not mine)
  3. Select Elastic Ips under Network and Security (on the left)
    • a. Select “Allocate Elastic IP Address” (top right)
    • b. Make sure the “Network Border Group” matches your instance availability zone from step 2
    • c. Click “Allocate”
    • d. Should receive a message “Elastic IP Address allocated successfully”
    • e. Select the displayed Elastic IP Address (may have to refresh page)
      • i. Actions dropdown at top right Associate Elastic IP Address
      • ii. Resource Type - Instance
      • iii. Put your cursor in the Instance text field
          1. It will show your stopped instance - select it
          1. Click “Associate”
  4. Start your instance back up a. The IP address shown will now stay the same whenever it is started or stopped
  5. Update your dynamic DNS from lab 11

Part #2: Protect web directory on your ec2-instance

Exercise

Create basic access control on your web site

  1. Log into ceclinux and then your ec2-instance
  2. Update global apache configuration file
    • a. sudo vim /etc/httpd/conf/httpd.conf or sudo nano /etc/httpd/conf/httpd.conf
    • b. Find the section
  3. Create password file
    • a. htpasswd -c ~/.htpasswd USERNAME (make up your own username)
    • b. Enter the password
    • c. Re-enter the password
  4. Create the apache access control file (requires anyone accessing the website to need the password, except for me to grade)

Part #3: Load Rest Server and Database into cloud

Exercise

  • Get archive file cd /tmp
  • Test the database using your web admin program
  • Verify that the database is accessible
  • Paste the “Query used to create this table”from the admin program into your canvas assignment (Find those exact words)
  • Test the applications final.php (rest server which adds data to database)

Part #4: Backup (snapshot) your ec2 volume

Exercise

  • Log into aws academy
  • Go to the ec2 instances - display your running instance
  • Select the instance, and right click on the instance id Images and Templates Create Image
  • Enter a name for this image
  • Press Create Image

This is a good safeguard when you are making operating system changes.

Make a screengrab showing the backup is being made

Do this any time you make operating system changes (any time you use “sudo”)