0% found this document useful (0 votes)
74 views25 pages

EC2 (Elastic Compute Cloud)

The document provides information about Amazon EC2 including: - EC2 uses Xen hypervisor for virtualization. AMIs are templates used to launch EC2 instances. Instance metadata and details can be retrieved via the metadata endpoint. - EBS volumes are network-attached storage for EC2 instances, unlike instance store volumes which are physically attached. EBS supports snapshots for backup and copying volumes. - EFS provides network file storage that can be mounted on multiple EC2 instances simultaneously. - Lambda allows running code without provisioning or managing servers. A lab demonstrates creating a serverless text message reminder service using Lambda and SNS. - Other labs show how to create AMIs for backups, launch

Uploaded by

I'm Ranga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views25 pages

EC2 (Elastic Compute Cloud)

The document provides information about Amazon EC2 including: - EC2 uses Xen hypervisor for virtualization. AMIs are templates used to launch EC2 instances. Instance metadata and details can be retrieved via the metadata endpoint. - EBS volumes are network-attached storage for EC2 instances, unlike instance store volumes which are physically attached. EBS supports snapshots for backup and copying volumes. - EFS provides network file storage that can be mounted on multiple EC2 instances simultaneously. - Lambda allows running code without provisioning or managing servers. A lab demonstrates creating a serverless text message reminder service using Lambda and SNS. - Other labs show how to create AMIs for backups, launch

Uploaded by

I'm Ranga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

2.

EC2 (Elastic Compute Cloud)


Friday, January 19, 2018 12:24 PM

EC2 BASICS

AMI : Amazon Machine Image

AWS used Xen hypervisor for virtualization :

AWS Certified Solutions Architect - Associate Page 1


To get the instance detail using bootstrap :

curl http://169.254.169.254/latest/user-data/ (Displays Bootstrapping Commands)


curl http://169.254.169.254/latest/meta-data/ (Displays AMI, Instance Type)

AWS Certified Solutions Architect - Associate Page 2


Elastic Block Storage (EBS) Snap-shot

EBS(Elastic Block Store) are network attached, not the physically attached to the host machine.

Instance Store Volume : Volume attached to the Host

EBS Volume

AWS Certified Solutions Architect - Associate Page 3


AWS Certified Solutions Architect - Associate Page 4
Elastic File System (EFS)

AWS Certified Solutions Architect - Associate Page 5


EC2 Shared Responsibility Model

Lambda Essentials:

AWS Certified Solutions Architect - Associate Page 6


LAB: Creating a Serverless Text Message Reminder Service in AWS using Lambda

AWS Certified Solutions Architect - Associate Page 7


1. Click on "Create a Function" button on Lambda Console

2. Select the option of Author from scratch.

AWS Certified Solutions Architect - Associate Page 8


3. Fill the details as per the code and its environment ,Here its python and click on create function button.

Hello World Lambda Function :

AWS Certified Solutions Architect - Associate Page 9


4. Copy and paste the Lambda code to the existing Lambda code :

import boto3

sns = boto3.client('sns')

def handler(event,context):
sns.publish(
PhoneNumber='+919980403905',
Message=(
'Hello how are you'
)
)
return 'success'

AWS Certified Solutions Architect - Associate Page 10


5. Here File name is lambda_function.py, so update the handler with the same. Ex lambda_function.handler

6. Here role will show the permission the role has attached to .Ex- CloudWatch and SNS . Click on Test Button.

AWS Certified Solutions Architect - Associate Page 11


6. Here role will show the permission the role has attached to .Ex- CloudWatch and SNS . Click on Test Button.

7. Configure the test event with name TestEvent. Click on "Create" button.

AWS Certified Solutions Architect - Associate Page 12


8. Click on Test Button.

AWS Certified Solutions Architect - Associate Page 13


Lab : EC2 Backup Solutions with AMIs and Snapshots

1. Launch as instance :

2. Login to the instance and do : pip install --upgrade --user awscli

AWS Certified Solutions Architect - Associate Page 14


A. Create the AMI :

AWS Certified Solutions Architect - Associate Page 15


4. Create an Instance from the AMI: select the image and click Launch

AWS Certified Solutions Architect - Associate Page 16


5. Login to the instance and run the same command which we run on the actual instance. Here it is showing the same :
[ec2-user@ip-10-0-1-227 ~]$ pip install --upgrade --user awscli
Requirement already up-to-date: awscli in ./.local/lib/python2.7/site-packages

AWS Certified Solutions Architect - Associate Page 17


6. Create Snapshots : Navigate to Volumes, under Elastic Block Store on the left menu. Select a volume, then click
Actions, Create Snapshot.

Creating the snap-shot of test Instance :

AWS Certified Solutions Architect - Associate Page 18


AWS Certified Solutions Architect - Associate Page 19
We can also see to which instance this volume was attached to.

Once we are deleting the instance the Volume attached will also get deleted:

AWS Certified Solutions Architect - Associate Page 20


Confirm the same on the volume tab and the attached volume should be deleted :

AWS Certified Solutions Architect - Associate Page 21


Generate a Volume from a Snapshot :

AWS Certified Solutions Architect - Associate Page 22


Accessing Instances User Data and Metadata :

1. Launch an EC2 instance with User data of : Under Advance option : paste the below code

#!/bin/bash
yum update -y
yum install -y httpd
service httpd start

AWS Certified Solutions Architect - Associate Page 23


2. Login to the instance and check for User data and meta data:

3. For example, view the instance ID :


[ec2-user@ip-10-0-0-248 ~]$ [ec2-user@ip] curl http://169.254.169.254/latest/meta-data/instance-
idi-0de46d0d5fe9bc993[ec2-user@ip-10-0-0-248]

AWS Certified Solutions Architect - Associate Page 24


AWS Certified Solutions Architect - Associate Page 25

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy