오토스케일링(Auto-scaling)은 AWS 클라우드를 통해 고확장성 서비스와 아키텍처를 구성하는 데 필요한 가장 중요한 요소 중 하나입니다. 이 강연에서는 효과적인 클라우드 인프라 구축을 위해 오토 스케일링을 활용하는 다양한 방법에 대해 자세히 소개해 드립니다.
오토 스케일링 그룹의 구성과 확장 계획에 따른 설정 방법, 오토 스케일링 라이프 사이클과 CloudWatch 및 알림을 이용한 관리 방법, 각종 오토스케일링 모범사례 등을 알아보실 수 있습니다.
3. 이번 웨비나 에서 들으실 내용..
오토스케일링(Autho-scaling)은 AWS 클라우드를 통해 확장성 높은
서비스와 아키텍쳐를 구성하는 가장 중요한 방식 중 하나입니다. 본
강연에서는 효과적인 클라우드 인프라 사용 패턴을 제공하기 위한
오토 스케일링에 대한 다양한 방법에 대해 자세히 소개해 드립니다.
4. v
Topics We’ll Cover
• Amazon EC2
• Types of Scaling
• Auto Scaling Introduction
• Auto Scaling Terminology
• Best Practices
• Console Demo
5. 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
7. 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
8. 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
9. v
Traditional IT Usage Patterns
On
and
Off
Fast
Growth
Variable
peaks
Predictable
peaks
10. v
Traditional IT Usage Patterns
On
and
Off
Fast
Growth
Variable
peaks
Predictable
peaks
Poor
Service
WASTE
11. 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
12. v
Cloud IT Usage Patterns (Auto
Scaling)
On
and
Off
Fast
Growth
Variable
peaks
Predictable
peaks
13. 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
14. 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.
15. 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
16. 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.
17. 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
18. v
Understanding Auto Scaling
Cooldowns
Auto Scaling group
alarm
Auto Scaling
New instance
EC2 instances
19. v
Understanding Auto Scaling
Cooldowns
Default
Cooldown
in
effect?
Launch
or
terminate
instance
Scaling
acDon
occurs
Ignore
acDon
No
Yes
22. 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
24. 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/
25. 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
26. 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
27. v
UserData and CloudInit
• CloudInit executes UserData on first boot if UserData begins
with:
• #! (Linux)
• <script> (Windows; technically, EC2Config, not CloudInit, does
this)
28. 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
29. 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)
33. 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…)
34. 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
35. v
Do
Use
IAM
roles
Go
keyless
if
you
can
Strike
a
balance
between
AMI
and
dynamic
bootstrapping
Some Do’s and Don’ts
36. 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
37. 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
38. 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
39. 온라인 자습 및 실습
다양한 온라인 강의 자
료 및 실습을 통해 AWS
에 대한 기초적인 사용
법 및 활용 방법을 익히
실 수 있습니다.
강의식 교육
AWS 전문 강사가 진행하는 강의를
통해 AWS 클라우드로 고가용성,
비용 효율성을 갖춘 안전한 애플리
케이션을 만드는 방법을 알아보세
요. 아키텍쳐 설계 및 구현에 대한
다양한 오프라인 강의가 개설되어
있습니다.
인증 시험을 통해 클라우
드에 대한 자신의 전문 지
식 및 경험을 공인받고 개
발 경력을 제시할 수 있습
니다.
AWS 공인 자격증
http://aws.amazon.com/ko/training
다양한 교육 프로그램
40. AWS 기초 웨비나 시리즈에 참여해 주셔서 감사합니다!
이번 웨비나가 여러분의 궁금증 해소에 도움이 되었길 바랍니다.
이후 이어질 설문 조사를 통해 오늘 웨비나에 대한 의견을 알려주세요.
aws-korea-marketing@amazon.com
http://twitter.com/AWSKorea
http://facebook.com/AmazonWebServices.ko
http://youtube.com/user/AWSKorea
http://slideshare.net/AWSKorea