Upload
amazon-web-services-korea
View
970
Download
12
Embed Size (px)
Citation preview
심화 웨비나 시리즈 | 7 번째 강연 2015년 7월 9일 목요일 | 오전 10시
http://aws.amazon.com/ko
오토스케일링 제대로 활용하기
김일호, Solutions Architect
이번 웨비나 에서 들으실 내용..
오토스케일링(Autho-scaling)은 AWS 클라우드를 통해 확장성 높은 서비스와 아키텍쳐를 구성하는 가장 중요한 방식 중 하나입니다. 본 강연에서는 효과적인 클라우드 인프라 사용 패턴을 제공하기 위한 오토 스케일링에 대한 다양한 방법에 대해 자세히 소개해 드립니다.
v
Topics We’ll Cover • Amazon EC2 • Types of Scaling • Auto Scaling Introduction • Auto Scaling Terminology • Best Practices • Console Demo
v
Basic unit of compute capacity Range of CPU, memory & local disk options
Feature Details
Flexible Run windows or linux distributions Scalable Wide range of instance types from micro to cluster compute
Machine Images Configurations can be saved as machine images (AMIs) from which new instances can be created
Full control Full root or administrator rights Secure Full firewall control via Security Groups
Monitoring Publishes metrics to Cloud Watch Inexpensive On-demand, Reserved and Spot instance types
VM Import/Export
Import and export VM images to transfer configurations in and out of EC2
Amazon Elastic Compute Cloud (EC2) Amazon EC2
v
Types of Scaling • Vertical Scaling
• Changing instance size • Increasing EBS Capacity
• Horizontal Scaling • Adding / removing instances • ELB
r3.8xlarge
c3.2xlarge
m3.medium
m3.medium m3.medium m3.medium
m3.medium m3.medium m3.medium
v
“We’re gonna need a bigger box” • Different EC2 instance type
• High memory instances • High CPU instances • High I/O instances • High storage instances
• Can now leverage PIOPs • Easy to change instance sizes • Will hit an endpoint eventually
r3.8xlarge
c3.2xlarge
m3.medium
v
“We’re gonna need a bigger box” • Different EC2 instance type
• High memory instances • High CPU instances • High I/O instances • High storage instances
• Can now leverage PIOPs • Easy to change instance sizes • Will hit an endpoint eventually
r3.8xlarge
c3.2xlarge
m3.medium
v
Traditional IT Usage Patterns
On and Off Fast Growth
Variable peaks Predictable peaks
v
Traditional IT Usage Patterns
On and Off Fast Growth
Variable peaks Predictable peaks
Poor Service
WASTE
v
Auto Scaling • Automatic resizing of compute clusters based on demand • Define minimum and maximum number of instances • Define when scaling out and in occurs • Use metrics collected in Amazon CloudWatch to drive scaling • Run Auto Scaling for On-Demand and Spot instance types • Its Free! Amazon
CloudWatch
Usage Metrics
Scaling InstrucDons
Auto Scaling Group
Queue Metrics
Auto Scaling
v
Cloud IT Usage Patterns (Auto Scaling)
On and Off Fast Growth
Variable peaks Predictable peaks
v
Terminology for Auto Scaling • Auto Scaling Group • Launch Configuration • Scaling Plan • Amazon CloudWatch Alarm • Amazon SNS Notification • Elastic Load Balancer • Instance Lifecycle • Instance Metadata / Userdata
v
Auto Scaling and AWS
Auto Scaling Groups • EC2 instances are categorized
into Auto Scaling groups. • Create Auto Scaling groups by
defining the minimum, maximum, and, opDonally, the desired number of running EC2 instances.
Launch Configura5on • Auto Scaling groups use a
launch configura.on to launch EC2 instances.
• Create the launch configuraDon by providing informaDon about the image you want Auto Scaling to use to launch EC2 instances
Scaling Plan • A scaling plan tells Auto
Scaling when and how to scale.
• Create a scaling plan based on the occurrence of specified condiDons (dynamic scaling) or create a plan based on a specific schedule.
v
Retrieving Resource Metrics • CloudWatch: A web service that enables you to monitor and manage various metrics, and configure alarm actions based on data from those metrics.
• A CloudWatch alarm is an object that monitors a single metric over a specific period.
• A metric is a variable that you want to monitor. eg: CPU usage, or incoming network traffic.
• The alarm changes its state when the value of the metric breaches a defined range and maintains the change for a specified number of periods.
CloudWatch
v
Planning your Auto Scaling Group • How long it takes to launch and configure a server • What metrics have the most relevance to your application's performance
• What existing resources (such as EC2 instances or AMIs) you might want to use as part of your Auto Scaling group
• How many Availability Zones you want to the Auto Scaling group to span
• The role you want Auto Scaling to play in your application.
v
Load Balance your Auto Scaling Group • Distribute incoming web traffic automatically. • Single point of entry for your application. • Sends data about your load balancers and EC2 instances to Amazon CloudWatch.
• Use Elastic Load Balancing metrics to scale your application. • Use connection draining to wait for the in-flight requests to complete.
ElasDc Load Balancing
v
Understanding Auto Scaling Cooldowns
Auto Scaling group
alarm
Auto Scaling
New instance
EC2 instances
v
Understanding Auto Scaling Cooldowns
Default Cooldown in effect?
Launch or terminate instance
Scaling acDon occurs
Ignore acDon
No
Yes
v
Auto Scaling Lifecycles
v
Auto Scaling Lifecycle Hooks
v
Introducing Bootstrapping Bootstrapping: some examples • 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 (Bash, Powershell) • Config Management Tools (Chef, Puppet) • Amazon OpsWorks
v
EC2 Metadata and UserData • Every EC2 Instance has access to local instance metadata and userdata service
• Metadata: immutable information about the instance Accessible from within the instance via HTTP at • http://169.254.169.254/latest/meta-data/
v
EC2 Metadata and UserData
EC2 Metadata and UserData Script(s) on instance may retrieve useful information about the instance, such as:
• Host name • AMI ID • Instance ID • Public/Private DNS • Availability Zone
v
EC2 Metadata and UserData
EC2 Metadata and UserData • Pass up to 16KB of text to an instance on launch • Text can be parsed by script on instance and used to configure the machine
v
UserData and CloudInit • CloudInit executes UserData on first boot if UserData begins with:
• #! (Linux) • <script> (Windows; technically, EC2Config, not CloudInit, does
this)
v
UserData and CloudInit • 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
v
UserData and CloudInit • 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)
v
Instance request
User data
v
Instance request
User data
Meta-‐data service
v
Instance request
User data
Instance
Meta-‐data service
v
33
Amazon Windows EC2Config Service executes user-‐data on launch: <script>dir > c:\test.log</script> <powershell>any command that you can run</powershell> <powershell>
Read-S3Object -BucketName myS3Bucket -Key myFolder/myFile.zip -File c:\destinationFile.zip
</powershell>
AWS Powershell Tools (use IAM roles as before…)
v
Why do this?
AutomaDon Less fingers, less mistakes
Availability Drive higher
availability with self-‐healing
Security Instances locked down by default
Flexible Shell, Powershell, CloudFormaDon,C
hef, Puppet, OpsWorks
Scale Manage large scale
deployments and drive autoscaling
Efficiency Audit and manage your estate with less
Dme & effort
v
Do
Use IAM roles
Go keyless if you can
Strike a balance between AMI and dynamic bootstrapping
Some Do’s and Don’ts
v
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)
L
Some Do’s and Don’ts
v
Autoscaling isn’t one size fits all • Choose the right metrics
• CPU Usage • Queue Depth • Number of concurrent users
• Scale too aggressively • Overprovisioning: increases costs • Bounciness: Add more than you need and have to partially scale back
shortly after scaling up, increasing costs. • Scale too timidly
• Poor performance • Outages due to lack of capacity
• Scale out early / Scale in slowly
v
What’s new? • Attach / Detach Instances from Auto Scaling Groups • Place instances into Standby State to Troubleshoot • Hold instances in Pending state for installing software / retrieve logs
• Create an Auto Scaling Group / Launch Configuration based on a running instance
온라인 자습 및 실습
다양한 온라인 강의 자료 및 실습을 통해 AWS에 대한 기초적인 사용법 및 활용 방법을 익히
실 수 있습니다.
강의식 교육
AWS 전문 강사가 진행하는 강의를 통해 AWS 클라우드로 고가용성,
비용 효율성을 갖춘 안전한 애플리케이션을 만드는 방법을 알아보세요. 아키텍쳐 설계 및 구현에 대한 다양한 오프라인 강의가 개설되어
있습니다.
인증 시험을 통해 클라우드에 대한 자신의 전문 지식 및 경험을 공인받고 개발 경력을 제시할 수 있습
니다.
AWS 공인 자격증
http://aws.amazon.com/ko/training
다양한 교육 프로그램
AWS 기초 웨비나 시리즈에 참여해 주셔서 감사합니다! 이번 웨비나가 여러분의 궁금증 해소에 도움이 되었길 바랍니다. 이후 이어질 설문 조사를 통해 오늘 웨비나에 대한 의견을 알려주세요. [email protected] http://twitter.com/AWSKorea http://facebook.com/AmazonWebServices.ko http://youtube.com/user/AWSKorea http://slideshare.net/AWSKorea