AWS Cloud Practitioner: Elastic Compute Cloud

In this short series, I outline the notes that I took while preparing for the AWS Cloud Practitioner exam.

These are my personal notes that I have made while working through the A Cloud Guru exam practitioner course. They are in no way official notes from AWS.

I would advise you that if you do use my notes to help you revise for this exam, that you use them as a supplement to the most recent information in the White PapersExam Guide and go over your knowledge with practice exam papers.

Previous notes within this blog series:

EC2 101

  • Elastic Compute Cloud (EC2) is virtual machines in the cloud
  • Reduces the time required to obtain and boot new server instances to minutes rather than months
  • Allows you to scale your capacity up and down and out (e.g. behind a load balancer)
  • Allows you to pay for only the capacity that you use as you use it by the hour or even by the second

Different Pricing Options

  • On Demand – pay a fixed rate by the hour or second with no commitment (linux by sec, windows by hour)
  • Reserved Instances – provide you with a capacity reservation and offers you a significant discount on the hourly charge for an instance.
  • Spot Instances – enables you to bid whatever price you want for the instance capacity, providing for even greater savings if you have flexible start and end times
  • Dedicated Hosts – Physical EC2 server dedicated for your use. Can help reduce costs by allowing you to use your existing server-bound software licenses

On Demand

  • For users that want low cost, flexible payment with no long term commitment or upfront payment.
  • Applications with short term, spiky or unpredictable workloads that cannot be interrupted
  • Applications being developed or tested on EC2 for the first time

Reserved Instances

  • Applications with steady state or predictable usage
  • Applications that require reserved capacity
  • Users can make upfront payments to reduce their total computing costs

Spot Instances

  • Applications that have flexible start and end times
  • Applications that are only feasible at very low compute prices
  • Users with an urgent need of large amount of computing capacity
  • If Amazon terminate your instance you will charged for partial usage, if you terminate the instance, you will be charged for the full hour

Dedicated Hosts

  • Physical EC2 servers
  • Useful for regulatory requirements that may not support multi-tenant virtualisation.
  • Great for licensing (which does not support multi-tenancy or cloud deployments)
  • Can be purchased On-Demand
  • Can be purchased as Reservation for up to 70% off the On-Demand price

EC2 Instance Types

Remember the letters not the numbers.

F FPGA
I IOPS
G Graphics
H High Disk Throughput
T cheap general purpose (T2 Micro)
D Density
R RAM
M main choice for general purpose apps
C Compute
P Graphics (think Pics)
X Extreme Memory
Z Extreme Memory AND CPU

What is EBS?

  • Elastic block storage
  • Allows you to create storage volumes and attach them to Amazon EC2 instances.
  • Once attached, you can create a file system on top of these volumes, run a database or use them like any block device.
  • EBS volumes are in AZ where they are automatically replicated to protect you from the failure of a single component
    Like a D: drives on PCs

EBS Volume Types

SSD

  • General Purpose SSD (GP2)
    • Balances both price and performance
    • Ratio of 3 IOPS per GB with up to 10,000 IOPS and burst of up to 3000 IOPS
  • Provisioned IOPS SSD (IO1)
    • Designed for I/O intensive applications such as large relational or NoSQL dbs
    • More than 10000 IOPS
    • Provision up to 20,000 IOPS per volume

HDD

  • Throughput Optimized HDD (ST1)
    • Big data
    • Data warehouses
    • Log processing
    • Cannot be a boot volume
  • Cold HDD (SC1)
    • Lowest cost storage for infrequently accessed workloads
    • File server
    • Cannot be a boot volume
  • Magnetic (Standard)
    • Lowest cost per GB of all EBS volume types that is bootable
    • Ideal for workloads where data is accessed infrequently, and applications where the lowest storage cost is important
    • Legacy, but can still be used

Using EC2

  • EC2 is a compute based service.
  • It is not serverless. It’s a virtual server.
  • Use a private key (.pem) to connect to EC2 (Mac) or Putty converting your .pem to a .ppk file.
  • Security groups are virtual firewalls in the cloud
  • You need to open ports to use them e.g. SSH (22) (only for Linux instances), HTTP (80), HTTPS (443), RDP (3389) (only for Windows)
  • Always design for failure. Have one EC2 instance in each AZ

Using the AWS Command Line

Mac

    • ssh into the EC2 instance using command line.
    • After downloading your private key
    • Go to the location you downloaded your private key

chmod 400 <.pem name>.pem
ssh ec2-user@ -i <.pem name>.pem

  • NOTE: Copy the IP address with dots not hyphens! The hyphens will not work.
  • Press yes if it prompts you about authenticity
  • Set yourself to be a super user using:
    sudo su
    yum update -y
    aws s3 ls *

*you may need to first aws configure

  • Add your access key ID from the S3 bucket and the secret key
  • Then set your default region e.g. eu-west-1 (Ireland)
  • Press Enter for the default output format
    aws s3 ls

Windows

  • Download Putty
  • Using the private key that you downloaded from your AWS instance, open your .pem file in PuttyGen
  • Generate a .ppk key from your .pem file
  • Save without a password
  • Close PuttyGen
  • Open Putty
  • Go to Auth and navigate to your.ppk location
  • Go to AWS grab the public IP of your AWS EC2 instance
  • Go to the Session tab in Putty
  • Paste in your IP into the Saved Sessions box and press Save
  • Paste the IP into the Host Name field and press Open
  • When the terminal opens, login as ec2-user and press Enter

  • You can interact with AWS in 3 ways:
    • Using the console (web interface)
    • Using the Command Line Interface (CLI)
    • Using the Software Development Kit (SDKs)
  • Linux server admin via Port 22
  • Microsoft server admin via Remote Desktop Port (RDP) Port 3389
  • Web server admin via Port 80 (HTTP) or 443 (HTTPS)
  • Security groups are like virtual firewalls in the cloud. When you want to let everything in 0.0.0.0/0. Just let in one IP in Public X.X.X.X/32. You need to open ports in order to use them.
  • Always Design for failure. Have one EC2 instance in each availability zone behind an Elastic Load Balancer.

Building a Web Server

  • Login to your ec2 instance by using ec2-user
  • Elevate the privileges of the user by using sudo su
  • Perform an update using yum update -y
  • Install apache to create a web server yum install httpd
  • Start the web server using service httpd start
  • Change directory to the content of the web server cd /var/www/html
  • Create an index.html using nano index.html
  • Add basic content to the page
  • Exit and save
  • In the browser, hit the public IP to see your webpage

Note: If you’re having issues connecting to your index.html content via your IP, check that the security groups on the web server are set up correctly. You need a security group for HTTP access to allow traffic into the server too, as well as SSH.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top