Amazon EC2
Amazon EC2
Amazon EC2
What is EC2?
Amazon elastic compute cloud is a web service that provides resizable compute capacity in the
cloud.
EC2 reduces the time required to obtain and boot new server instances to minutes, allowing you
to quickly scale capacity, both up and down, as your computing requirements change.
Reserved
Provides you with a capacity reservation, and offer a significant discount on the hourly charge for an
instance. Contract Terms area 1 year or 3 years (insignificant discount, the more you pay upfront, less it
costs)
Spot
Enables you to bid whatever price you want for instance capacity, providing for even greater savings if
your applications have flexible start and end times
Dedicated Hosts
Physical EC2 server dedicated for your use. Dedicated hosts can help you to use your existing server-
bound software licenses
1 is SQS, 2 is S3
S3 – Region based, but listed as global because the data is stored in over the regions
An AMI is a template that contains the software configuration (operating system, application server, and
applications) required to launch your instance
Amazon Linux 2 comes with five years support. It provides Linux kernel 4.14 tuned for optimal
performance on Amazon EC2, systemd 219, GCC 7.3, Glibc 2.26, Binutils 2.29.1, and the latest software
packages through extras.
Instance - From an AMI, you launch an instance(vCPU, Memory, Instance Storage, EBS – Optimized
Available, N/W Performance, IPv6 Support), which is a copy of the AMI running as a virtual server in the
cloud.
Variable ECUs, 1 vCPUs, 2.5 GHz, Intel Xeon Family, 1 GiB memory, EBS only
Snapshot - A snapshot is of an EBS volume where you are able to save state and reboot with the same
data at a certain point in time. An AMI is similar, but its for the EC2 instances themselves. You cannot
take a snapshot of a non ebs backed instance, but you can create a AMI (system image) of one.
2. Choose an Instance Type
Instances are virtual servers that can run applications
They have varying combinations of CPU, memory, storage, and networking capacity, and give you the
flexibility to choose the appropriate mix of resources for your applications
Reserved – long time contract. (whenever model is changed to new, it will apply both prices)
Mask – though you launch (price will apply) and instant discard, it will not discard price
http://techgenix.com/aws-instance-purchase-models-explained/
The strategy of the placement group determines how the instances are placed on underlying hardware.
A cluster placement group clusters instances into a low-latency group in a single Availability Zone.
(higher BW, there is no limitation in number of clusters)
A partition placement group spreads instances across logical partitions, ensuring that instances in one
partition do not share underlying hardware with instances in other partitions.
A spread placement group spreads instances across underlying hardware. (try not to have unique h/w,
one availability zone – only 7 can be launched, Security Content, Durability)
Addition of one more spread placement group – mother and child can be in same h/w in this case
Launch an instance in a placement group to benefit from greater redundancy or higher networking
throughput
Placement group:
When comes to hadoop, or performance, they will want the instance to be in same rack.
Capacity Reservation
Capacity Reservations reserve capacity for your EC2 instances in a specific Availability Zone. You can
launch instances into a Capacity Reservation if they have matching attributes (instance type, platform,
and Availability Zone), and available capacity.
Monitoring
For default 5 mins, detailed can be selected using cloud watch
Nagios,
Tenancy
You can choose to run your instances on physical servers fully dedicated for your use. The use of host
tenancy will request to launch instances onto Dedicated hosts (https://aws.amazon.com/ec2/dedicated-
hosts/), while the use of dedicated tenancy will launch instances as Dedicated instances
(https://aws.amazon.com/dedicated-instances/). You can launch an instance with a tenancy of host or
dedicated into a Dedicated VPC.ed –
T series
Enabling T2/T3 Unlimited allows applications to burst beyond the baseline for as long as needed at any
time. If the average CPU utilization of the instance is at or below the baseline, the hourly instance price
automatically covers all usage. Otherwise, all usage above baseline is billed.
User Data
Script – window – power
You can specify user data to configure an instance or run a configuration script during launch. If you
launch more than one instance at a time, the user data is available to all the instances in that
reservation.
4. Add Storage
Volume type
5. Security Group
Firewall
A security group is a set of firewall rules that control the traffic for your instance. On this page, you can
add rules to allow specific traffic to reach your instance. For example, if you want to set up a web server
and allow Internet traffic to reach your instance, add rules that allow unrestricted access to the HTTP
and HTTPS ports.
6. Terminate Instance
Using AWS Management Console to Copy AWS EBS Volumes Between Regions
https://cloud.netapp.com/blog/ebs-volumes-5-lesser-known-functions
Connect to Linux Instance
1. Root user
2. System update
3. Install Apache server
7. Navigate to html
8. Create html page
Vim index.html
ec2-13-232-196-53.ap-south-1.compute.amazonaws.com
Administrator
YR@l%XFwush*;*UbFM.BCEn?DZqzfrUT
Right click in Disk 1 and Disk 2 and give Online
Again right click on Disk 1 and Disk 2 and give Initialise disk
raid o for performance stripped volume
Instance Store Volume – The root device for an instance launched from the AMI is an instance store
volume created from a template stored in Amazon S3.
Load Balancing
High availability –
Request is sent to Load Balancer and then it is sent to each instance with web server
2. Choose AMI
3. Select Launch configuration – Choose Instance Type
4. Configure Details
5. Add Storage
Snapshot
Snapshots only capture data that has been written to your amazon EBS volume at the time the snapshot
command is used.
AMI
AMI is a special type of virtual appliance that is used to instantiate a virtual machine within EC2. It serves
as the basic unit of deployment for services delivered using EC2.
Create Template
1. Create launch template
2. Launch Instance from template
Classic Load Balancer
1. Select Load Balance Type
Serverless computing - - Actions against a function, request is routed to server based on the action
Regional based
Scaling up means increasing the resources in terms of RAM such as 8 GB to 12 GB.
5. Add Trigger
6. Select API Gateway
7. Select LambdaOne to create function in python
8. Select API Gateway
http://maha312.s3-website.ap-south-1.amazonaws.com
16. Copy the python code to Lambda Function
17. Text is displayed on clicking the button
direct connect
vpn