SlideShare une entreprise Scribd logo
1  sur  63
Amazon EC2 Masterclass 
Chris Fleischmann and Matthew Liddle 
fchris@amazon.com & liddlem@amazon.com
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
v 
EC2 Basics 
Virtual Servers in the Cloud 
• One instance to thousands of instances 
• In any public AWS region 
• Create, start, stop, configure, monitor as desired 
• Install any software: web, business, client/server, 
batch processing 
• Pay only for capacity you use 
• Variety of cost models Amazon EC2
EC2 Basics: cost models 
Customers can combine multiple purchase types to optimize pricing based on current and forecast capacity needs. 
v 
On-Demand Reserved Spot Dedicated 
Pay upfront in exchange for hourly 
prices that are 50-75% lower than 
On-Demand 
Pay for compute capacity by 
the hour. No long-term 
commitments 
Bid for unused Amazon EC2 
capacity 
Launch instances in VPC on 
dedicated customer hardware 
Spiky workloads Committed utilization Time-insensitive workloads Highly sensitive workloads
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
Provisioning and Lifecycle 
v 
• Create -> Start -> Stop -> Terminate 
• Manually in console 
• Automate via API (or other tools) 
• Automatically based on demand 
(demand curve)
Typical weekly traffic to Amazon.com 
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Typical weekly traffic to Amazon.com 
Provisioned capacity 
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
November traffic to Amazon.com 
November
November traffic to Amazon.com 
76% 
24% 
Provisioned capacity 
November
November traffic to Amazon.com - Match IT Resources to Application Demand 
November
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
v 
Instance Types 
GPU 
Enabled 
General 
Purpose 
Storage and IO 
Optimized 
Compute 
Optimized 
Memory 
Optimized 
M3 C3 I2 HS1 
M3 C3 I2 
G2 R3 
G2 
M1 C1 CC2 HI1 HS1 CG1 M2 
CR1 
Added 
Instance 
Types
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
Amazon Machine Images 
v 
Your machine images 
AMIs you have created from EC2 instances 
Can be kept private or shared with other 
accounts 
Amazon maintained 
Set of Linux and Windows images 
Kept up to date by Amazon in each 
region 
Community maintained 
Images published by other AWS users 
Managed and maintained by Marketplace 
partners
Amazon Machine Images 
v
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
v 
Bootstrapping 
Bake an AMI 
Start an instance 
Configure the instance 
Create an AMI from your 
instance 
Start new ones from the AMI
v 
Bootstrapping 
Bake an AMI 
Start an instance 
Configure the instance 
Create an AMI from your 
instance 
Start new ones from the AMI 
Configure dynamically 
Launch an instance 
Use metadata service and 
cloud-init to perform actions on 
instance when it launches 
vs
v 
Bootstrapping 
Bake an AMI Configure dynamically 
Build your base images and 
setup custom initialisation 
scripts 
Maintain your ‘golden’ base 
Use bootstrapping to pass 
custom information in and 
perform post launch tasks like 
pulling code from SVN 
+
v 
Bootstrapping 
Bake an AMI Configure dynamically 
Time consuming configuration 
(startup time) 
Static configurations (less change 
management)
v 
Bootstrapping 
Bake an AMI Configure dynamically 
Continuous deployment (latest code) 
Environment specific (dev-test-prod)
Bootstrapping: some examples 
v 
• Install latest software 
• Copy data from S3 
• Register with DNS 
• Start services 
• Update packages 
• Reboot 
• Open port 80 
• Register with load balancer 
• Mount devices
v 
Bootstrapping: tools 
• Scripts on instance 
• Config Management Tools; puppet, chef, others. 
• Amazon OpsWorks
Bootstrapping: metadata and userdata 
• Every EC2 Instance has access to local instance 
v 
metadata and userdata service 
Instance 
request 
User 
data 
Meta-data 
service 
Instance
Bootstrapping: metadata and userdata 
• Metadata: immutable information about the instance 
v 
• Accessible from within the instance via HTTP at 
http://169.254.169.254/latest/meta-data/ 
• Script(s) on instance may retrieve useful information about the instance, such as: 
• Host name 
• AMI ID 
• Instance ID 
• Public/Private DNS 
• Availability Zone 
• An Example: Using Metadata to retrieve the hostname: 
# curl http://169.254.169.254/latest/meta-data/hostname 
ip-172-31-10-12.ap-southeast-2.compute.internal
Bootstrapping: metadata and userdata 
• User Data: pass up to 16KB of text v 
to an instance on launch 
• Accessible from within the instance via HTTP at 
http://169.254.169.254/latest/user-data/ 
• Text can be parsed by script on instance and used to configure the 
machine
Bootstrapping: metadata and userdata 
v 
Custom script on AMI 
(script_runner.py) fetches userdata, 
parses it, and configures EC2 Instance 
on boot
Bootstrapping: UserData and CloudInit 
v • CloudInit executes UserData on first boot if UserData begins with: 
• #! (Linux) 
• <script> (Windows; technically, EC2Config, not CloudInit, does this) 
• CloudInit is installed on Amazon Linux, Ubuntu, and RHEL AMIs 
• EC2Config is installed on Windows Server AMIs 
• Both may be installed on other distributions via a package repo or 
source
Bootstrapping: UserData and CloudInit 
v • UserData to install Apache and MySQL on boot, and attach an EIP: 
#!/bin/bash 
# Install Apache, PHP, and MySQL 
yum install –y httpd mysql-server 
# Attach an Elastic IP to this instance 
ec2-associate-address  
23.34.45.56  
-i $(curl http://169.254.169.254/latest/meta-data/instance-id)
Bootstrapping: AMIs 
v • Fully-Functional 
• Partially Configured 
• Base OS, Config with Code
v 
Bootstrapping: AMIs 
Apache 
Tomcat 
Struts 
Your Code 
Log4J 
Spring 
Hibernate 
JEE 
Linux 
Java App Stack 
Example full stack required to run your 
application. 
Let’s use the 3 AMI/bootstrapping 
techniques
v 
Bootstrapping: AMIs 
Fully-functional AMI is pre-build and 
ready to launch from the AMI inventory 
Apache 
Tomcat 
Struts 
Your Code 
Hibernate 
Apache 
Tomcat 
Struts 
Your Code 
Log4J 
Spring 
Hibernate 
JEE 
Linux 
Apache 
Tomcat 
Struts 
Your Code 
Log4J 
Spring 
Hibernate 
JEE 
Linux 
Apache 
Tomcat 
Struts 
Your Code 
Log4J 
Spring 
Hibernate 
JEE 
Linux 
Inventory of AMIs 
Log4J 
Spring 
JEE 
Linux 
Apache 
Tomcat 
Struts 
Your Code 
Log4J 
Spring 
Hibernate 
JEE 
Linux 
Amazon EC2 
Java AMI
v 
Bootstrapping: AMIs 
Partially-configured AMI 
A “Golden Image” is launched, with 
scripts fetching/installing app code 
and other supporting components on 
boot 
Fetch on boot 
Apac 
he 
Tom 
cat 
Hibe 
rnat 
e 
JEE 
Apac 
he 
Tom 
cat 
Hibe 
rnat 
e 
JEE 
Apac 
he 
Tom 
cat 
Hibe 
rnat 
e 
JEE 
Apac 
he 
Tom 
cat 
Hibe 
rnat 
e 
JEE 
Amazon EC2 
Your Code 
Struts 
Log4J 
S3 
Spring 
Apache 
Tomcat 
Hibernate 
JEE 
Java AMI 
Inventory of AMIs 
Linux 
Fetch on boot 
Linu 
x 
Linu 
x 
Linu 
x 
Linu 
x
v 
Bootstrapping: AMIs 
Base OS AMI 
An AMI with minimal components (OS, 
J2EE, and Chef/Puppet) is launched. 
All configuration occurs via 
Chef/Puppet after instance launch 
Fetch on boot 
JEE 
scripts 
JEE 
Amazon EC2 
Your Code 
Apache 
Struts 
Log4J 
Hibernate 
Spring 
S3 
JEE 
Tomcat 
OS AMI 
Inventory of AMIs 
Linux 
Linux 
Linux 
Chef/Puppet 
Chef/Puppet
Automation 
Less fingers, less mistakes 
Why do this? 
Availability 
Drive higher 
availability with self-healing 
Security 
Instances locked 
down by default 
Flexible 
Shell, 
Powershell, 
CloudFormation, 
Chef, Puppet, 
OpsWorks 
Scale 
Manage large scale 
deployments and drive 
autoscaling 
Efficiency 
Audit and manage 
your estate with 
less time & effort
Some dos and don’ts 
Do Don’t 
Use IAM roles 
Go keyless if you can 
Strike a balance between AMI and 
dynamic bootstrapping 
Put your API access keys into code 
(and then publish to GIT) or bake 
into AMIs (and share) 

Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
Monitoring EC2 with CloudWatch 
v
Amazon EC2 Masterclass 
EC2 Basics 
Instance Lifecycle 
EC2 Instance Types 
Using Amazon Machine Images 
Bootstrapping EC2 Instances 
Monitoring EC2 with CloudWatch 
Autoscaling
v 
Autoscaling 
• Auto Scaling 
• Scale your Amazon EC2 capacity up or down automatically 
according to conditions you define 
• Ensure that the number of Amazon EC2 instances you’re 
using increases seamlessly during demand spikes to 
maintain performance, and decreases automatically 
during demand lulls to minimize costs
Launch Configuration Auto-Scaling Group Auto-Scaling Policy 
Describes what Auto Scaling 
will create when adding 
Instances - Similar to ec2-run-instances 
API command 
AMI 
Instance Type 
Security Group 
Instance Key Pair 
Only one active launch 
configuration at a time 
Auto Scaling will terminate 
instances with old launch 
configuration first 
rolling update 
Auto Scaling managed 
grouping of EC2 instances 
Automatic health check to 
maintain pool size 
Automatically scale the number of 
instances by policy – Min, Max, 
Desired 
Automatic Integration with ELB 
Automatic distribution & 
balancing across AZs 
Parameters for performing an 
Auto Scaling action 
Scale Up/Down and by how much 
ChangeInCapacity (+/- #) 
ExactCapacity (#) 
ChangeInPercent (+/- %) 
Cool Down (seconds) 
Policy can be triggered by 
CloudWatch events
v 
Autoscaling
v 
Autoscaling
v 
Autoscaling
v 
Autoscaling
v 
Autoscaling
Autoscaling: Auto Scaling Group 
v 
Availability Zone A Availability Zone B
Autoscaling: Auto Scaling Group 
v 
Availability Zone A Availability Zone B
Autoscaling: Auto Scaling Group 
v 
Availability Zone A Availability Zone B
Autoscaling: Auto Scaling Group 
v 
Availability Zone A Availability Zone B
Autoscaling: Auto Scaling Group 
v 
Availability Zone A Availability Zone B
Autoscaling: ELB + CloudWatch 
v 
Latency 
ELB 
Auto scaling Group 
Auto Scaling CloudWatch
v 
Autoscaling: DEMO 
• Tools Used: 
• CloudFormation script – 
• Create a multi-AZ, load balanced and Auto Scaled sample web site running on an Apache 
Web Server. The application is configured to span all Availability Zones in the region and 
is Auto-Scaled based on the CPU utilization of the web servers. 
• CPU script – 
• Logging on to an m3.medium instance to generate CPU load (simulating heavy CPU 
usage) to see the autoscaling working: 
• while true; do echo; done
Stop doing these: 
Provisioning and fixing servers 
Treating compute as physical things 
Thinking of compute as a finite commitment
Security 
Build systems secure by 
default 
Elasticity 
Stateless autoscaling 
applications 
Automation 
Create instances when 
you need them, drop 
them when not 
and start doing these 
Replace not fix 
Build from scratch, don’t 
fix something 
Unconstrained 
Say goodbye to 
traditional capacity 
planning 
Be cost aware 
Tag resources, play with 
instance types
Online Labs | Training 
Gain confidence and hands-on 
experience with AWS. Watch free 
Instructional Videos and explore Self- 
Paced Labs 
Instructor Led Classes 
Learn how to design, deploy and operate 
highly available, cost-effective and secure 
applications on AWS in courses led by 
qualified AWS instructors 
AWS Certification 
Validate your technical expertise 
with AWS and use practice exams 
to help you prepare for AWS 
Certification 
http://aws.amazon.com/training
v 
Questions?
v 
Appendix
v 
Demo Information 
• CloudFormation script 
• Auto-scaling group configuration: 
• Min: 1 
• Max: 3 
• Cooldown: 300 
• Scaling Policies: 
• Scaling Up: 
• CPU Utilization > 80% for 2 consecutive periods of 60 seconds 
• Action: Add 1 instance 
• Then wait: 60 seconds before next operation 
• Scaling Down: 
• CPU Utilization < 15% for 2 consecutive periods of 60 seconds 
• Action: Remove 1 instance 
• Then wait: 60 seconds before next operation 
• 100% CPU Script (NASTY): while true; do echo; done

Contenu connexe

Tendances

High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
Stoyan Stefanov
 

Tendances (20)

AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
 
Airbnb가 직접 들려주는 Kubernetes 환경 구축 이야기 - Melanie Cebula 소프트웨어 엔지니어, Airbnb :: A...
Airbnb가 직접 들려주는 Kubernetes 환경 구축 이야기 - Melanie Cebula 소프트웨어 엔지니어, Airbnb :: A...Airbnb가 직접 들려주는 Kubernetes 환경 구축 이야기 - Melanie Cebula 소프트웨어 엔지니어, Airbnb :: A...
Airbnb가 직접 들려주는 Kubernetes 환경 구축 이야기 - Melanie Cebula 소프트웨어 엔지니어, Airbnb :: A...
 
Container, Container, Container -유재석 (AWS 솔루션즈 아키텍트)
Container, Container, Container -유재석 (AWS 솔루션즈 아키텍트)Container, Container, Container -유재석 (AWS 솔루션즈 아키텍트)
Container, Container, Container -유재석 (AWS 솔루션즈 아키텍트)
 
Your First Week with Amazon EC2
Your First Week with Amazon EC2Your First Week with Amazon EC2
Your First Week with Amazon EC2
 
20190318 Amazon EC2 スポットインスタンス再入門
20190318 Amazon EC2 スポットインスタンス再入門20190318 Amazon EC2 スポットインスタンス再入門
20190318 Amazon EC2 スポットインスタンス再入門
 
Amazon SageMaker를 통한 대용량 모델 훈련 방법 살펴보기 - 김대근 AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 최영준...
Amazon SageMaker를 통한 대용량 모델 훈련 방법 살펴보기 - 김대근 AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 최영준...Amazon SageMaker를 통한 대용량 모델 훈련 방법 살펴보기 - 김대근 AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 최영준...
Amazon SageMaker를 통한 대용량 모델 훈련 방법 살펴보기 - 김대근 AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 최영준...
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
 
[AWS Dev Day] 실습워크샵 | 모두를 위한 컴퓨터 비전 딥러닝 툴킷, GluonCV 따라하기
[AWS Dev Day] 실습워크샵 | 모두를 위한 컴퓨터 비전 딥러닝 툴킷, GluonCV 따라하기[AWS Dev Day] 실습워크샵 | 모두를 위한 컴퓨터 비전 딥러닝 툴킷, GluonCV 따라하기
[AWS Dev Day] 실습워크샵 | 모두를 위한 컴퓨터 비전 딥러닝 툴킷, GluonCV 따라하기
 
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
 
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
게임을 위한 Cloud Native on AWS (김일호 솔루션즈 아키텍트, AWS) :: Gaming on AWS 2018
 
Amazon EC2 and Amazon VPC Hands-On Workshop
Amazon EC2 and Amazon VPC Hands-On WorkshopAmazon EC2 and Amazon VPC Hands-On Workshop
Amazon EC2 and Amazon VPC Hands-On Workshop
 
[AWS Dev Day] 인공지능 / 기계 학습 | AWS 기반 기계 학습 자동화 및 최적화를 위한 실전 기법 - 남궁영환 AWS 솔루션...
[AWS Dev Day] 인공지능 / 기계 학습 |  AWS 기반 기계 학습 자동화 및 최적화를 위한 실전 기법 - 남궁영환 AWS 솔루션...[AWS Dev Day] 인공지능 / 기계 학습 |  AWS 기반 기계 학습 자동화 및 최적화를 위한 실전 기법 - 남궁영환 AWS 솔루션...
[AWS Dev Day] 인공지능 / 기계 학습 | AWS 기반 기계 학습 자동화 및 최적화를 위한 실전 기법 - 남궁영환 AWS 솔루션...
 
Well-Architected for Security: Advanced Session
Well-Architected for Security: Advanced SessionWell-Architected for Security: Advanced Session
Well-Architected for Security: Advanced Session
 
20191029 AWS Black Belt Online Seminar Elastic Load Balancing (ELB)
20191029 AWS Black Belt Online Seminar Elastic Load Balancing (ELB)20191029 AWS Black Belt Online Seminar Elastic Load Balancing (ELB)
20191029 AWS Black Belt Online Seminar Elastic Load Balancing (ELB)
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & MicroservicesIVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
 
Deep Dive into Amazon ECS & Fargate
Deep Dive into Amazon ECS & FargateDeep Dive into Amazon ECS & Fargate
Deep Dive into Amazon ECS & Fargate
 
[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...
[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...
[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...
 
[AWS Innovate 온라인 컨퍼런스] 간단한 Python 코드만으로 높은 성능의 기계 학습 모델 만들기 - 김무현, AWS Sr.데이...
[AWS Innovate 온라인 컨퍼런스] 간단한 Python 코드만으로 높은 성능의 기계 학습 모델 만들기 - 김무현, AWS Sr.데이...[AWS Innovate 온라인 컨퍼런스] 간단한 Python 코드만으로 높은 성능의 기계 학습 모델 만들기 - 김무현, AWS Sr.데이...
[AWS Innovate 온라인 컨퍼런스] 간단한 Python 코드만으로 높은 성능의 기계 학습 모델 만들기 - 김무현, AWS Sr.데이...
 
[AWS Innovate 온라인 컨퍼런스] Kubernetes와 SageMaker를 활용하여 Machine Learning 워크로드 관리하...
[AWS Innovate 온라인 컨퍼런스] Kubernetes와 SageMaker를 활용하여 Machine Learning 워크로드 관리하...[AWS Innovate 온라인 컨퍼런스] Kubernetes와 SageMaker를 활용하여 Machine Learning 워크로드 관리하...
[AWS Innovate 온라인 컨퍼런스] Kubernetes와 SageMaker를 활용하여 Machine Learning 워크로드 관리하...
 
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
 

En vedette

En vedette (20)

Auto Scaling Groups
Auto Scaling GroupsAuto Scaling Groups
Auto Scaling Groups
 
Auto Scaling on AWS
Auto Scaling on AWSAuto Scaling on AWS
Auto Scaling on AWS
 
Security & Compliance in AWS
Security & Compliance in AWSSecurity & Compliance in AWS
Security & Compliance in AWS
 
Aws Elastic Block Storage
Aws Elastic Block StorageAws Elastic Block Storage
Aws Elastic Block Storage
 
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
 
Migrating to Amazon RDS with Database Migration Service
Migrating to Amazon RDS with Database Migration ServiceMigrating to Amazon RDS with Database Migration Service
Migrating to Amazon RDS with Database Migration Service
 
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxNEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
 
Deep Dive on Amazon EC2 Instances - January 2017 AWS Online Tech Talks
Deep Dive on Amazon EC2 Instances - January 2017 AWS Online Tech TalksDeep Dive on Amazon EC2 Instances - January 2017 AWS Online Tech Talks
Deep Dive on Amazon EC2 Instances - January 2017 AWS Online Tech Talks
 
(SDD408) Amazon Route 53 Deep Dive: Delivering Resiliency, Minimizing Latency...
(SDD408) Amazon Route 53 Deep Dive: Delivering Resiliency, Minimizing Latency...(SDD408) Amazon Route 53 Deep Dive: Delivering Resiliency, Minimizing Latency...
(SDD408) Amazon Route 53 Deep Dive: Delivering Resiliency, Minimizing Latency...
 
Secure Amazon EC2 Environment with AWS IAM & Resource-Based Permissions (CPN2...
Secure Amazon EC2 Environment with AWS IAM & Resource-Based Permissions (CPN2...Secure Amazon EC2 Environment with AWS IAM & Resource-Based Permissions (CPN2...
Secure Amazon EC2 Environment with AWS IAM & Resource-Based Permissions (CPN2...
 
Creating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & AlexaCreating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & Alexa
 
Introduction to Amazon DynamoDB
Introduction to Amazon DynamoDBIntroduction to Amazon DynamoDB
Introduction to Amazon DynamoDB
 
Web Security Automation: Spend Less Time Securing your Applications
 	  Web Security Automation: Spend Less Time Securing your Applications 	  Web Security Automation: Spend Less Time Securing your Applications
Web Security Automation: Spend Less Time Securing your Applications
 
Visualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSightVisualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSight
 
Amazon EC2 Masterclass
Amazon EC2 MasterclassAmazon EC2 Masterclass
Amazon EC2 Masterclass
 
AWS re:Invent 2016: DNS Demystified: Getting Started with Amazon Route 53, fe...
AWS re:Invent 2016: DNS Demystified: Getting Started with Amazon Route 53, fe...AWS re:Invent 2016: DNS Demystified: Getting Started with Amazon Route 53, fe...
AWS re:Invent 2016: DNS Demystified: Getting Started with Amazon Route 53, fe...
 
Advanced Approaches to Amazon VPC and Amazon Route 53 | AWS Public Sector Sum...
Advanced Approaches to Amazon VPC and Amazon Route 53 | AWS Public Sector Sum...Advanced Approaches to Amazon VPC and Amazon Route 53 | AWS Public Sector Sum...
Advanced Approaches to Amazon VPC and Amazon Route 53 | AWS Public Sector Sum...
 
(SEC302) IAM Best Practices To Live By
(SEC302) IAM Best Practices To Live By(SEC302) IAM Best Practices To Live By
(SEC302) IAM Best Practices To Live By
 
Elasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch ServiceElasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch Service
 
Best Practices of IoT Security in the Cloud
Best Practices of IoT Security in the CloudBest Practices of IoT Security in the Cloud
Best Practices of IoT Security in the Cloud
 

Similaire à Day 2 - Amazon EC2 Masterclass - Getting the most from Amazon EC2

Similaire à Day 2 - Amazon EC2 Masterclass - Getting the most from Amazon EC2 (20)

AWS APAC Webinar Week - Getting The Most From EC2
AWS APAC Webinar Week - Getting The Most From EC2AWS APAC Webinar Week - Getting The Most From EC2
AWS APAC Webinar Week - Getting The Most From EC2
 
Leveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSLeveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWS
 
Leveraging elastic web scale computing with AWS
 Leveraging elastic web scale computing with AWS Leveraging elastic web scale computing with AWS
Leveraging elastic web scale computing with AWS
 
Leveraging Elastic Web Scale Computing with AWS
 Leveraging Elastic Web Scale Computing with AWS Leveraging Elastic Web Scale Computing with AWS
Leveraging Elastic Web Scale Computing with AWS
 
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
 
Day 5 - AWS Autoscaling Master Class - The New Capacity Plan
Day 5 - AWS Autoscaling Master Class - The New Capacity PlanDay 5 - AWS Autoscaling Master Class - The New Capacity Plan
Day 5 - AWS Autoscaling Master Class - The New Capacity Plan
 
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
 
Scaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloudScaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloud
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3
 
Amazon cloud intance launch
Amazon cloud intance launchAmazon cloud intance launch
Amazon cloud intance launch
 
Architecting Cloud Apps
Architecting Cloud AppsArchitecting Cloud Apps
Architecting Cloud Apps
 
Creating scalable solutions with aws
Creating scalable solutions with awsCreating scalable solutions with aws
Creating scalable solutions with aws
 
McrUmbMeetup 22 May 14: Umbraco and Amazon
McrUmbMeetup 22 May 14: Umbraco and AmazonMcrUmbMeetup 22 May 14: Umbraco and Amazon
McrUmbMeetup 22 May 14: Umbraco and Amazon
 
Architecting for the Cloud: Best Practices
Architecting for the Cloud: Best PracticesArchitecting for the Cloud: Best Practices
Architecting for the Cloud: Best Practices
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web Services
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web Services
 
AWS Certified Solutions Architect Associate Notes.pdf
AWS Certified Solutions Architect Associate Notes.pdfAWS Certified Solutions Architect Associate Notes.pdf
AWS Certified Solutions Architect Associate Notes.pdf
 
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh VariaAWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
 
Automating Security in your IaC Pipeline
Automating Security in your IaC PipelineAutomating Security in your IaC Pipeline
Automating Security in your IaC Pipeline
 

Plus de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Dernier

Dernier (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Day 2 - Amazon EC2 Masterclass - Getting the most from Amazon EC2

  • 1. Amazon EC2 Masterclass Chris Fleischmann and Matthew Liddle fchris@amazon.com & liddlem@amazon.com
  • 2. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 3. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 4. v EC2 Basics Virtual Servers in the Cloud • One instance to thousands of instances • In any public AWS region • Create, start, stop, configure, monitor as desired • Install any software: web, business, client/server, batch processing • Pay only for capacity you use • Variety of cost models Amazon EC2
  • 5. EC2 Basics: cost models Customers can combine multiple purchase types to optimize pricing based on current and forecast capacity needs. v On-Demand Reserved Spot Dedicated Pay upfront in exchange for hourly prices that are 50-75% lower than On-Demand Pay for compute capacity by the hour. No long-term commitments Bid for unused Amazon EC2 capacity Launch instances in VPC on dedicated customer hardware Spiky workloads Committed utilization Time-insensitive workloads Highly sensitive workloads
  • 6. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 7. Provisioning and Lifecycle v • Create -> Start -> Stop -> Terminate • Manually in console • Automate via API (or other tools) • Automatically based on demand (demand curve)
  • 8. Typical weekly traffic to Amazon.com Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  • 9. Typical weekly traffic to Amazon.com Provisioned capacity Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  • 10. November traffic to Amazon.com November
  • 11. November traffic to Amazon.com 76% 24% Provisioned capacity November
  • 12. November traffic to Amazon.com - Match IT Resources to Application Demand November
  • 13. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 14. v Instance Types GPU Enabled General Purpose Storage and IO Optimized Compute Optimized Memory Optimized M3 C3 I2 HS1 M3 C3 I2 G2 R3 G2 M1 C1 CC2 HI1 HS1 CG1 M2 CR1 Added Instance Types
  • 15. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 16. Amazon Machine Images v Your machine images AMIs you have created from EC2 instances Can be kept private or shared with other accounts Amazon maintained Set of Linux and Windows images Kept up to date by Amazon in each region Community maintained Images published by other AWS users Managed and maintained by Marketplace partners
  • 18. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 19. v Bootstrapping Bake an AMI Start an instance Configure the instance Create an AMI from your instance Start new ones from the AMI
  • 20. v Bootstrapping Bake an AMI Start an instance Configure the instance Create an AMI from your instance Start new ones from the AMI Configure dynamically Launch an instance Use metadata service and cloud-init to perform actions on instance when it launches vs
  • 21. v Bootstrapping Bake an AMI Configure dynamically Build your base images and setup custom initialisation scripts Maintain your ‘golden’ base Use bootstrapping to pass custom information in and perform post launch tasks like pulling code from SVN +
  • 22. v Bootstrapping Bake an AMI Configure dynamically Time consuming configuration (startup time) Static configurations (less change management)
  • 23. v Bootstrapping Bake an AMI Configure dynamically Continuous deployment (latest code) Environment specific (dev-test-prod)
  • 24. Bootstrapping: some examples v • Install latest software • Copy data from S3 • Register with DNS • Start services • Update packages • Reboot • Open port 80 • Register with load balancer • Mount devices
  • 25. v Bootstrapping: tools • Scripts on instance • Config Management Tools; puppet, chef, others. • Amazon OpsWorks
  • 26. Bootstrapping: metadata and userdata • Every EC2 Instance has access to local instance v metadata and userdata service Instance request User data Meta-data service Instance
  • 27. Bootstrapping: metadata and userdata • Metadata: immutable information about the instance v • Accessible from within the instance via HTTP at http://169.254.169.254/latest/meta-data/ • Script(s) on instance may retrieve useful information about the instance, such as: • Host name • AMI ID • Instance ID • Public/Private DNS • Availability Zone • An Example: Using Metadata to retrieve the hostname: # curl http://169.254.169.254/latest/meta-data/hostname ip-172-31-10-12.ap-southeast-2.compute.internal
  • 28. Bootstrapping: metadata and userdata • User Data: pass up to 16KB of text v to an instance on launch • Accessible from within the instance via HTTP at http://169.254.169.254/latest/user-data/ • Text can be parsed by script on instance and used to configure the machine
  • 29. Bootstrapping: metadata and userdata v Custom script on AMI (script_runner.py) fetches userdata, parses it, and configures EC2 Instance on boot
  • 30. Bootstrapping: UserData and CloudInit v • CloudInit executes UserData on first boot if UserData begins with: • #! (Linux) • <script> (Windows; technically, EC2Config, not CloudInit, does this) • CloudInit is installed on Amazon Linux, Ubuntu, and RHEL AMIs • EC2Config is installed on Windows Server AMIs • Both may be installed on other distributions via a package repo or source
  • 31. Bootstrapping: UserData and CloudInit v • UserData to install Apache and MySQL on boot, and attach an EIP: #!/bin/bash # Install Apache, PHP, and MySQL yum install –y httpd mysql-server # Attach an Elastic IP to this instance ec2-associate-address 23.34.45.56 -i $(curl http://169.254.169.254/latest/meta-data/instance-id)
  • 32. Bootstrapping: AMIs v • Fully-Functional • Partially Configured • Base OS, Config with Code
  • 33. v Bootstrapping: AMIs Apache Tomcat Struts Your Code Log4J Spring Hibernate JEE Linux Java App Stack Example full stack required to run your application. Let’s use the 3 AMI/bootstrapping techniques
  • 34. v Bootstrapping: AMIs Fully-functional AMI is pre-build and ready to launch from the AMI inventory Apache Tomcat Struts Your Code Hibernate Apache Tomcat Struts Your Code Log4J Spring Hibernate JEE Linux Apache Tomcat Struts Your Code Log4J Spring Hibernate JEE Linux Apache Tomcat Struts Your Code Log4J Spring Hibernate JEE Linux Inventory of AMIs Log4J Spring JEE Linux Apache Tomcat Struts Your Code Log4J Spring Hibernate JEE Linux Amazon EC2 Java AMI
  • 35. v Bootstrapping: AMIs Partially-configured AMI A “Golden Image” is launched, with scripts fetching/installing app code and other supporting components on boot Fetch on boot Apac he Tom cat Hibe rnat e JEE Apac he Tom cat Hibe rnat e JEE Apac he Tom cat Hibe rnat e JEE Apac he Tom cat Hibe rnat e JEE Amazon EC2 Your Code Struts Log4J S3 Spring Apache Tomcat Hibernate JEE Java AMI Inventory of AMIs Linux Fetch on boot Linu x Linu x Linu x Linu x
  • 36. v Bootstrapping: AMIs Base OS AMI An AMI with minimal components (OS, J2EE, and Chef/Puppet) is launched. All configuration occurs via Chef/Puppet after instance launch Fetch on boot JEE scripts JEE Amazon EC2 Your Code Apache Struts Log4J Hibernate Spring S3 JEE Tomcat OS AMI Inventory of AMIs Linux Linux Linux Chef/Puppet Chef/Puppet
  • 37. Automation Less fingers, less mistakes Why do this? Availability Drive higher availability with self-healing Security Instances locked down by default Flexible Shell, Powershell, CloudFormation, Chef, Puppet, OpsWorks Scale Manage large scale deployments and drive autoscaling Efficiency Audit and manage your estate with less time & effort
  • 38. Some dos and don’ts Do Don’t Use IAM roles Go keyless if you can Strike a balance between AMI and dynamic bootstrapping Put your API access keys into code (and then publish to GIT) or bake into AMIs (and share) 
  • 39. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 40. Monitoring EC2 with CloudWatch v
  • 41. Amazon EC2 Masterclass EC2 Basics Instance Lifecycle EC2 Instance Types Using Amazon Machine Images Bootstrapping EC2 Instances Monitoring EC2 with CloudWatch Autoscaling
  • 42. v Autoscaling • Auto Scaling • Scale your Amazon EC2 capacity up or down automatically according to conditions you define • Ensure that the number of Amazon EC2 instances you’re using increases seamlessly during demand spikes to maintain performance, and decreases automatically during demand lulls to minimize costs
  • 43. Launch Configuration Auto-Scaling Group Auto-Scaling Policy Describes what Auto Scaling will create when adding Instances - Similar to ec2-run-instances API command AMI Instance Type Security Group Instance Key Pair Only one active launch configuration at a time Auto Scaling will terminate instances with old launch configuration first rolling update Auto Scaling managed grouping of EC2 instances Automatic health check to maintain pool size Automatically scale the number of instances by policy – Min, Max, Desired Automatic Integration with ELB Automatic distribution & balancing across AZs Parameters for performing an Auto Scaling action Scale Up/Down and by how much ChangeInCapacity (+/- #) ExactCapacity (#) ChangeInPercent (+/- %) Cool Down (seconds) Policy can be triggered by CloudWatch events
  • 49. Autoscaling: Auto Scaling Group v Availability Zone A Availability Zone B
  • 50. Autoscaling: Auto Scaling Group v Availability Zone A Availability Zone B
  • 51. Autoscaling: Auto Scaling Group v Availability Zone A Availability Zone B
  • 52. Autoscaling: Auto Scaling Group v Availability Zone A Availability Zone B
  • 53. Autoscaling: Auto Scaling Group v Availability Zone A Availability Zone B
  • 54. Autoscaling: ELB + CloudWatch v Latency ELB Auto scaling Group Auto Scaling CloudWatch
  • 55. v Autoscaling: DEMO • Tools Used: • CloudFormation script – • Create a multi-AZ, load balanced and Auto Scaled sample web site running on an Apache Web Server. The application is configured to span all Availability Zones in the region and is Auto-Scaled based on the CPU utilization of the web servers. • CPU script – • Logging on to an m3.medium instance to generate CPU load (simulating heavy CPU usage) to see the autoscaling working: • while true; do echo; done
  • 56. Stop doing these: Provisioning and fixing servers Treating compute as physical things Thinking of compute as a finite commitment
  • 57. Security Build systems secure by default Elasticity Stateless autoscaling applications Automation Create instances when you need them, drop them when not and start doing these Replace not fix Build from scratch, don’t fix something Unconstrained Say goodbye to traditional capacity planning Be cost aware Tag resources, play with instance types
  • 58. Online Labs | Training Gain confidence and hands-on experience with AWS. Watch free Instructional Videos and explore Self- Paced Labs Instructor Led Classes Learn how to design, deploy and operate highly available, cost-effective and secure applications on AWS in courses led by qualified AWS instructors AWS Certification Validate your technical expertise with AWS and use practice exams to help you prepare for AWS Certification http://aws.amazon.com/training
  • 59.
  • 61.
  • 63. v Demo Information • CloudFormation script • Auto-scaling group configuration: • Min: 1 • Max: 3 • Cooldown: 300 • Scaling Policies: • Scaling Up: • CPU Utilization > 80% for 2 consecutive periods of 60 seconds • Action: Add 1 instance • Then wait: 60 seconds before next operation • Scaling Down: • CPU Utilization < 15% for 2 consecutive periods of 60 seconds • Action: Remove 1 instance • Then wait: 60 seconds before next operation • 100% CPU Script (NASTY): while true; do echo; done

Notes de l'éditeur

  1. The AWS Core Benefit – Cost Savings Pricing Models There are a number of types of pricing models available that give companies of all sizes flexibility. Here are 3 pricing models. On-Demand Instances let you pay for compute capacity by the hour with no long-term commitments. This frees you from the costs and complexities of planning, purchasing, and maintaining hardware and transforms what are commonly large fixed costs into much smaller variable costs. Reserved Instances give you the option to make a low, one-time payment for each instance you want to reserve and in turn receive a significant discount on the hourly charge for that instance. This is good for those with steady-state workloads who want to pay upfront in exchange for hourly prices that are 50-75% lower than what you get for on-demand instances. Spot Instances enable you to bid for unused Amazon EC2 capacity. Instances are charged the Spot Price, which is set by Amazon EC2 and fluctuates periodically depending on the supply of and demand for Spot Instance capacity. This is good for customers who have opportunistic workloads that can afford to be interrupted and want the lowest possible price. Dedicated Instances Dedicated Instances are Amazon EC2 instances launched within your VPC that run hardware dedicated to a single customer. Dedicated Instances let you take full advantage of the benefits of Amazon VPC and the AWS cloud – on-demand elastic provisioning, pay only for what you use, and a private, isolated virtual network, all while ensuring that your Amazon EC2 compute instances will be isolated at the hardware level. Some of the larger customers run reserved instances for their steady-state workloads to maximize their savings on an per-hourly basis. They then fill in the rest of their workloads with either on-demand or spot instances depending on whether or not their applications can afford to be utilized over a period of time or be interrupted.
  2. The following illustration represents the transitions between instance states. Notice that you can't stop and start an instance store-backed instance. For more information about instance store-backed instances, see Storage for the Root Device.
  3. This scenario may occur throughout the day as well
  4. This scenario may occur throughout the day as well
  5. This scenario may occur throughout the day as well
  6. This scenario may occur throughout the day as well
  7. This scenario may occur throughout the day as well
  8. Broad Set of Compute Instance Types A good example of the breadth of features and of AWS’ approach, is in the instance types available on EC2. After eight years, AWS has built out a collection of instance types which move beyond just general purpose utility computing, into application-optimized instances. AWS has spent a lot of time in the past year adding what it considers to be the next generation of instance families to EC2, for both general purpose workloads, and application specific optimized instances. Today, these instance families have been extended further.
  9. Bootstrapping actions can be almost anything. Here are some examples.
  10. Bootstrapping actions can be almost anything. Here are some examples.
  11. Bootstrapping actions can be almost anything. Here are some examples.
  12. You can specify UserData in a couple of ways. The Management Console, for example, provides you with the option of including UserData when you spin up a new EC2 instance.
  13. I said that most EC2 instances use CloudInit (or EC2Config). Let’s get more specific: CloudInit is available on Amazon Linux, Ubuntu, and RHEL Amazon Machine Images (AMIs). EC2Config is on all Windows Server AMIs. Either one may be available on other distributions, however.
  14. Here’s an example of UserData that: Installs Apache Installs MySQL Attaches an Amazon Elastic IP address (EIP)
  15. With Auto Scaling, you can scale your EC2 instances up and down automatically. You can also ensure that EC2 instances increase and decrease seamlessly.
  16. You can configure Auto Scaling through the EC2 dashboard, as shown here.
  17. Creating a launch configuration is almost identical to launching an EC2 instance. You specify options for the AMI, storage, tags, and so on.
  18. Auto Scaling configurations can also take bootstrapping scripts and configuration instructions, just like EC2 instances. Notice also that you need to give every launch configuration that you create a name.
  19. Again, you can create an Auto Scaling group using the AWS Management Console. With an auto scaling group, you define: The name of the group The launch configuration you want to use The size of the auto scaling group Whether to launch the Auto Scaling group within a VPC or not How to load balance between auto scaling group instances How to monitor the health of instances in an auto scaling group
  20. In addition, you can also establish auto scaling policies, which dynamic increase or decrease EC2 instances based on CloudWatch alarms. Note that it's always a good idea to ensure that your auto scaling group handles both scaling UP (adding instances) and scaling DOWN (removing instances). This is one way you can help maximize your IT budget—by adding and removing instances when needed.
  21. Here’s what this Auto Scaling group looks like. Notice that we have four instances (as we specified in the desired-capacity parameter) running across two Availability Zones, all registered with one ELB.
  22. If one instance goes down…
  23. The Auto Scaling group spins up a new one.
  24. If the instances in one Availability Zone aren’t accessible…
  25. New instances are started in the other Availability Zone.
  26. All of these service work well individually, but together the become more powerful and increase the control and flexibility our customers demand.
  27. All of these service work well individually, but together the become more powerful and increase the control and flexibility our customers demand.
  28. All of these service work well individually, but together the become more powerful and increase the control and flexibility our customers demand.