AWS Classroomnotes 11/Sep/2022

Different Resources/Services Attached to EC2

  • AWS EC2 instance should be created in some AZ.
  • By default in every AWS region, AWS pre-creates a default vpc with subnet for each AZ.
  • While creating the ec2 instance, we can select AZ by selecting subnet
  • When we select a subnet an Elastic Network Interface (ENI) will be getting a private ip and will be attached to ec2 instacnce.
  • Public ip is enabled by default.
  • Public ip is not charged by default, when we create an ec2 instance AWS has a large pool of available public ips and one public ip will be used for mapping public ip to private ip.
  • When we shutdown the ec2 instance, the public ip is released & will go back to aws public ip pool.
  • So thats the reason the public ip changes after stopping and starting the ec2 instance.
  • If we need same ip even after restart, then we need go pay for static ip address which is referred as elastic ip.
  • AWS also gives a dns name for public ip and private ip (in default vpc’s).
  • To filter out which traffic that is allowed to your ec2 instance, we use security group
  • To login into ec2 instance we need credentials i.e. key pairs
  • For now i will be using existing key pair created in previous session
  • Lets create a security group which allows ssh connection from any where (SSH => 22 port)





  • Lets select an AMI (Amazon Machine Image). See below for basic AMI intro


  • Now lets select Network Settings
    • Public ip or not
    • Which AZ
    • Which Security Group




  • Lets connect to this ec2 instance
    • Command ssh -i <path to pem> username@<ip address>

  • Lets look at
    • ENI
    • EBS Volume

Activity 1:

  • Create a new key pair called as ec2learning.pem in the region of your choice
  • Create a new security group which open
    • tcp 22 port for every one
    • tcp 80 port for every one
  • Create an ec2 instance in the AZ-B
  • Ensure the machine has public ip
  • Create the instance with ubuntu 18.04
  • Login into the ec2 instance and execute the following commands
sudo apt update
sudo apt install apache2 -y
sudo apt install stress -y
  • browse http://<publicip>

Activity 2

  • We are generating a key pair by using AWS
  • Now lets create a Key pair on your laptop and upload the public key to AWS
  • Launch Powershell and execute ssh-keygen
  • Now navigate to ~\.ssh
  • id_rsa => private key
  • id_rsa.pub => public key
  • Now open key pairs section from ec2 console


  • Now repeat Activity 1 with imported key pair
  • Login into ec2 instance (ubuntu 18) ssh -i ~/.ssh/id_rsa ubuntu@<publicip>


  • Note: Delete all the instances after usage.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%