<- Blog Home

AWS Important Concepts

Create new EC2 instance

Let us now see how to build ami in ec2. EC2 can be created using below images

  • AMI
  • Windows
  • Linux
  • Mac

EC2 instance types

Ref - https://aws.amazon.com/ec2/instance-types/ Here is the list of instance types

  • General Purpose - M1, M4, M5, M6, T2(Burstable and cheapest, available in Free Tier), T3, T4, Mac
  • Compute Optimized - C4, C5, C6, C7
  • Memory Optimized - X1, X2, R4, R5, R6
  • Accelerated Computing - G3, G4, G5, P2, P3, P4
  • Storage Optimized - H1, D3, D2, I3, I4

Instances can be divided in 3 main categories

  • Fixed Performance

  • Burstable Performance - You get cpu credits for unused cpu cycles. How to use credits in ec2?

  • Spot instances

You can find out your EC2 instance type by going to EC2 dashboard. You can change or upgrade the instance type in future if need arises.

How to login to ec2 using SSH

First you need to create a ssh key pair before launching the EC2 instance for the first time. Public key is saved on EC2 and private key needs to kept on your local machine. You can access cli/console in ec2 using private ssh key using command like below.

ssh -i "awaken.pem" [email protected]

This is how you can login or connect to ec2 using ssh.

Root device

Root device types

  • Instance Store Backed - Data is lost after EC2 restart
  • EBS Backed - Elastic Block Storage - e.g. /dev/xvda - after ec2 restart, data is persistent

How to find root device type for EC2

You can find it in storage section of EC2

EBS volume in ec2

  • Create and attach volume - You can go to Elastic Block Store section EC2 and then create and attach volume to EC2.
  • How to expand ebs volume in ec2

Elastic IP

What is Elastic IP

Elastic IP address is a permanent IP address linked with your instance. After ec2 restart, ip address does not change.

How to create Elastic IP

In EC2 dashboard, under network and security, you can find the Elastic IPs section.

Elastic IP Pricing

Elastic IP is free of cost if you meet below conditions.

  • It is associated with an EC2 instance.
  • EC2 instane is running.
  • Only one Elastic IP address is attached to EC2
  • The Elastic IP address is associated with an attached network interface.

e.g. If multiple IPs are associated with EC2, then you will be charged for extra IP

Public and Private IP address

How to find public ip in ec2

One EC2 dashboard -> Instance summary page

How to find the private ip address

One EC2 dashboard -> Instance summary page

Public DNS

One EC2 dashboard -> Instance summary page

Networking in EC2 - VPC and subnet

VPC stands for virtual private cloud. When we create new EC2, EC2 instance is added in a default VPC. Region -> Availability Zone -> EC2 instance

  • How to create and change subnet in ec2
  • How to monitor network traffic in ec2
  • How to make vpc default in ec2
  • How to make a subnet private in ec2
  • network performance in ec2
  • nat gateway in ec2
  • network interface in ec2
  • How to open port in ec2
  • openvpn in ec2
  • How to change private ip in ec2
  • How to change security group in ec2
  • How to change subnet in ec2
  • aws How to use nat gateway in ec2

Security Group in EC2

Security group settings allow you to block an ip address in ec2 To create or change security groups in ec2, you need to "Security Groups" section under network and security.

For each security group, you can specify inbound (who can talk to EC2) and outbound rules(EC2 can talk to which machines/services). Protocol, port range and destination addresses can be specified in rules.

e.g. If you want to whitelist ip addresses that can talk to EC2, you can specify these addresses in inbound rules.

  • IP version - e.g. IPv4
  • Type - e.g. HTTP, HTTPS, SSH, Custom
  • Protocol - e.g. TCP
  • Port range - e.g. 80 or 443 or 22 or 8080 or 3000
  • Source - e.g. 0.0.0.0/0

EC2 tasks

Below tasks can be done by logging into EC2 and then based on machine image, you can use system commands.

  • How to add ssh key in ec2
  • How to add user in ec2
  • How to assume role in ec2
  • How to build a website in ec2
  • How to check memory usage in ec2
  • dynamodb in ec2
  • docker image in ec2
  • Launch instance
  • How to upgrade instance in ec2
  • aws How to update an ami in ec2
  • How to clone instance in ec2
  • How to delete instance in ec2
  • How to delete terminated instance in ec2
  • How to delete account in ec2
  • How to delete network interface in ec2
  • How to delete all resources in ec2
  • How to get instance id in ec2
  • How to install git in ec2
  • How to find account id in ec2
  • How to find resource by arn in ec2
  • How to restore from snapshot in ec2
  • free tier in ec2
  • full form in ec2
  • https in ec2
  • hibernate in ec2
  • hypervisor in ec2
  • aws How to generate access key in ec2
  • aws How to get session token in ec2
  • hostname in ec2
  • How to increase disk size in ec2
  • How to increase memory in ec2
  • How to install ssm agent in ec2
  • How to invoke lambda in ec2
  • How to import certificate in ec2
  • How to increase volume size in ec2
  • How to increase root volume size in ec2
  • How to install pip in ec2
  • jenkins in ec2
  • java in ec2
  • How to know who created a resource in ec2
  • How to know my region in ec2
  • How to list all services in use in ec2
  • How to check memory usage in ec2
  • aws How to name instance in ec2
  • nginx in ec2
  • nodejs in ec2
  • yum install in ec2
  • yarn install in ec2
  • to putty in ec2
  • How to remove terminated instance in ec2
  • aws How to remove instance in ec2
  • aws How to restart instance in ec2
  • aws How to remove public ip in ec2
  • aws How to snapshot in ec2
  • aws How to terminate instance in ec2
  • How to remove terminated instance in ec2
  • aws How to upload files in ec2
  • aws How to terminate account in ec2
  • How to remove credit card in ec2
  • quotas in ec2
  • query metadata in ec2
  • query api in ec2

health check in ec2

cloudwatch agent in ec2

SSH key pair

How to download pem file again in ec2 - How to get pem file in ec2 How to find secret access key in ec2

ECS in ec2

ECS stands for elastic container service. ECS manages the cluster of EC2 instances.

The container agent runs on EC2 and communicates with Amazon ECS.

EKS in ec2 - Elastic K8s Service

EFS - Elastic File System - in ec2

Secure AWS account

How to enable and enforce mfa in ec2

Cost and billing

How to estimate cost in ec2 aws How to pay bill in ec2

fargate in ec2

gcp vs ec2 vs digitalocean vs heroku vs linode vs azure

Website hosting

aws How to host a website in ec2 aws How to host static website in ec2

kinesis in ec2

free tier in ec2

lightsail in ec2

S3

aws How to make bucket public in ec2 no space left on device in ec2 How to access s3 in ec2 to s3 data transfer in ec2 aws How to query s3 in ec2

nails in ec2

nitro in ec2

on demand vs spot in ec2

Dynamodb

  • Dynamodb is a NoSQL databased from amazon
  • How to query dynamodb in ec2

RDS

  • Relational Database system
  • How to query rds in ec2

R53 in AWS

  • route 53 in ec2
  • How to transfer domain in ec2

AWS Lambda

  • aws How to trigger lambda in ec2
  • aws How to test lambda locally in ec2
  • aws How to test lambda in ec2

Secrets manager in ec2

Secret manager is used to store app secrets, keys, passwords etc

SQS in EC2

  • Simple Queue Service
  • SQS vs RabbitMQ vs Kafka

windows instance in ec2

  • How to create new windows instance
  • How to connect to windows instance in ec2 - rds connection in ec2?

AWS CloudFormation

This is used to create and manage resources (software and machines) in cloud. .yaml or .json files can be created to write cloudformation templates.

We specify below things

  • Resource name
  • Resource type - AWS::Lambda::Function
  • Resource props

Infrastructure as a code in aws

  • ARM templates vs AWS CloudFormation vs Google deployment manager vs Terrform vs Ansible
  • AWS cloudformation eqivalent in Azure is "ARM Templates" and in google cloud, it is Google deployment manager
  • Terrform vs ansible vs chef vs puppet
  • They are used to provision software and machines
  • Terraform is mainly used for infrastructure while ansible is used for configuration purpose.
  • Terraform is platform agnostic meaning it supports providers like aws, azure, fastly, k8s
  • ansible vs chef are procedural
  • Terraform is declarative and open source

Example

Let us say you want to deploy app on aws, you will need to do 2 steps

  • Provisioning infrastructure (Devops) - Create EC2, VPC, Security groups, IP addresses, EBS, S3 bucket
  • Deploying app (Developers)
Complex problems, Simple Solutions