EC2 Fundamentals-AWS

EC2
Budget Setup!

EC2 Basics

  • Virtual Machines (EC2)
  • Data storage on virtual drives (EBS)
  • Distributing load across machines (ELB)
  • Scaling the services using an auto-scaling group (ASG)

Now, in order to use EC2, you need to configure some stuff as well. Those are CPU, RAM, Storage space, Network card: speed of the card, public IP address, security group, and Bootstrap script: EC2 user data which only runs at launch.

  • Installing updates
  • Installing software and other tasks.

Launching EC2 Instance:

AMI & Instance Type & User Data!

EC2 Instance Type:

→ m5.2xlarge
m: instance class
5: generation
2xlarge: size within the instance class

Storage & Tags & Security Groups!
The instance is launched!
Instance Reply via public IP!

EC2 User data →
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo “<h1> Hello World from $(hostname -f)</h1>” > /var/www/html/index.html

Security Groups (SG):

  • Access to ports
  • Manage IP ranges (IPv4 and IPv6)
  • Control inbound network
  • Control outbound network
  • SG can be attached to multiple instances.
  • Can be locked down to a region.
  • SG lives outside of EC2. If SG blocked something, then EC2 will not see it.
  • Maintain one SG for SSH access.
  • If the application is not accessible (time out). then it’s a security group issue.
  • Connection refused, then it’s an application error.
  • All outbound traffic is authorized by default.

Some classic ports that you need to know:

  • 22 (SSH) to log into a Linux instance
  • 21 (FTP) file transfer protocol to upload files into a file share
  • 22 (SFTP) secure file transfer protocol to upload files using SSH
  • 80 (HTTP) to access secured websites
  • 443 (HTTPS) to access secured websites
  • 3389 (RDP) remote desktop protocol to log into a windows instance.
Security Group!

chmod 0400 EC2Learning.pem

ssh -i EC2Learning.pem ec2-user@39.500.365.125

EC2 Instance Connect:

EC2 Instance Connect and Accessed!
  • On-Demand Instances: short workload, predictable pricing
    — pay for what you use
    — Linux and windows — pay per second
    — other OS — pay per hour
    — No commitment
    — Pay high per use
  • Reserved (Minimum 1 year): Up to 75% discount compared to On-Demand (1 year to 3 years)
    — Reserved Instance: long workloads(Reserve a specific instance type: for a database)
    — Convertible Reserved Instances: long workloads with flexible instances (Can change EC2 instance)
    — Scheduled Reserved Instances: Example — every Monday between 3–6 pm
  • Spot Instances (highest discount on AWS -95% compared to On-demand)
    — Spot price can change and if you don’t pay then you will lose
    — Not suitable for critical jobs and databases
  • Dedicated Hosts:
    — An Amazon EC2 dedicated host is a physical server with EC2 instance capacity fully dedicated to your use. That helps with compliance requirements and reduces costs by allowing you to use your existing server-bound software license.
    — Allocated for your account for a 3-year reservation.
    — Costly
  • Dedicated Instances
    — Instances running on hardware dedicated to you.
    — May share hardware with other instances in the same account
    — No control over instance placement (can move hardware after stop/start)

--

--

--

Python Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Warcraft Ii Tides Of Darkness Download Mac

Three of the following four words are alike in a certain way and one i

Master regex hands-on

Regex example

Create Your First Golang App

iOS Daemon Journey

CSS backdrop-filter

AWS Instance with Http enabled

Flutter Analysis and Practice: Practices of High-Performance Dynamic Template Rendering

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mahedi Hasan Jisan

Mahedi Hasan Jisan

Python Developer

More from Medium

How To Use The AWS CLI To Create An EC2 and Launch an Apache Web Server

Web stack incident — Example of a Postmortem

Getting endpoint load time using Selenium 3 and python — like the network tab in chrome debugger

Deploy Containerized Flask app to Heroku