AWS Classroom Series – 11/Aug/2020

AWS Savings Plan

  • In Reserved we get discounts for long term commitments with amazon, Rather than commitment for an ec2 for complete year, you can go with commit of usage hours per year.
  • You can get discounts upto 72%

Different Resources required for ec2 instance

  • When we create an instance what are different other resources required
    • AMI (Amazon Machine Image)
    • Network (VPC (Region) and subnet (Availability Zone))
    • Storage (Disk) => EBS (Elastic Block Storage)
    • Security Group (Allows only the communication to specific ports which you have opened)
    • Elastic Network Interface: This is what receives a private ip & public ip address
    • KeyPair: Private and public key pair for logging into ec2

Amazon Machine Images

  • In any hypervisor, Create a virtual machine image is cloning the disk of running vm & then creating an image from it. Then use this image to create multiple virtual machines Preview
  • In the case of Amazon
    • Virtual Machine => EC2
    • Disk => EBS
    • Clone => Snapshot
    • VM image => AMI
  • Every AMI in amazon has an unique AMI id.
  • AMI can be selected based on following characteristics
    • Region
    • Operating System
    • Architecture (32 or 64 bit)
    • Launch permissions
    • Storage for the root device
  • Launch Permissions: The owner of AMI will determine its availability by specifying launch permissions.
    • public: Owners grants access to all aws accounts to launch
    • explicit: Owner grants access to specific aws accounts
    • private: Only owner AWS account has a launch permission
  • When we create an AMI, we will have storage costs as AMI needs storage.
  • Virtualization Types: There are two virtualization types in AMI
    • paravirtual (pv)
    • HVM (hardware virtual machine)
  • Major difference between PV and HVM AMIs are in the way the boot, HVM takes advantage of special hardware extensions for better performance
  • Shared AMI: AMI created and made available for usage to all aws accounts by amazon or other aws accounts
  • Paid AMI: This ia AMI that can be purchase from some AMI developer(Organization)

Creating an AMI

  • When we create an AMI, the steps are
    • Create an ec2 instance
    • Install the necessary softwares
    • Create an AMI
  • AMI gets created only in the region where you have created an ec2 instance, if you want it different regions, you have to copy ami to region which will create new ami id & new storage for ami
  • Lets create an AMI for lamp stack
    1. Create an ubuntu 18 ec2 instance
    2. ssh into ec2 instance and execute commands as specified over here
    sudo apt-get update
    sudo apt-get install apache2 -y
    sudo apt install php libapache2-mod-php php-mysql -y
    sudo apt install php-cli -y
    sudo -i
    echo "<?php phpinfo(); ?>" >> /var/www/html/info.php
    sudo systemctl restart apache2
    
    1. Now navigate to http://<public-ip>/info.php Preview
    2. So to create an AMI, Preview Preview Preview Preview Preview
  • Lets create an ec2 instance with private ami created Preview Preview Preview
  • AMI’s can be copy to other regions Preview Preview
  • AMI’s can be made public or explicit Preview Preview
  • To delete AMI , you need to deregister Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin