2. What
is
Auto
Scaling?
• Make
your
compu=ng
power
pure
ELASTIC.
• Increase
or
Decrease
Compu=ng
Power
as
your
applica=on
DEMAND.
– If
Demand
Compu=ng
"
– If
Demand
Compu=ng
"
5. Infrastructure
Cost
High
Capital
Expenditure
You
just
lost
your
customer
Predicted
demand
Actual
Demand
Scale-‐up
approach
Time
6. Infrastructure
Cost
Too
much
excess
Capacity
High
Capital
Expenditure
You
just
lost
your
customer
Predicted
demand
Actual
Demand
Scale-‐up
approach
Tradi=onal
Scale-‐out
approach
Time
7. Infrastructure
Cost
Too
much
excess
Capacity
High
Capital
Expenditure
You
just
lost
your
customer
Predicted
demand
Actual
Demand
Scale-‐up
approach
Tradi=onal
Scale-‐out
approach
Automated
Elas=city
Time
8. Why
?
• Get
rid
of
preemp=on.
• No
need
to
worry
for
cost
of
stale
hardware.
• No
worries
of
being
short
than
demand.
• Cost
of
hardware
is
propor=onal
to
demand.
9. What’s
in
Store
?
• No
Extra
charge
(if
you
have
already
enabled
Cloud
Watch)
• Also
help
in
maintaining
EC2
fleet
at
fixed
Size.
• Mul=ple
proper=es
(metrics)
to
configure.
– Can
club
proper=es
as
well.
10. Auto
Scaling
APIs
•
as-‐create-‐auto-‐scaling-‐group
–
Create
a
new
auto
scaling
group
with
specified
name
and
other
aTributes
• as-‐create-‐launch-‐config
– Create
a
new
launch
config
with
specified
aTributes.
• as-‐create-‐or-‐update-‐trigger
– Creates
a
new
trigger
or
updates
an
exis=ng
trigger.
• as-‐delete-‐auto-‐scaling-‐group
– Delete
the
specified
auto
scaling
group
if
the
group
has
no
instances
and
no
scaling
ac=vi=es
in
progress.
• as-‐delete-‐launch-‐config
– Delete
the
specified
launch
configura=on.
• as-‐delete-‐trigger
– Delete
a
trigger.
• as-‐describe-‐auto-‐scaling-‐groups
– Describes
the
specified
auto
scaling
group(s)
if
the
group(s)
exists.
11. Auto
Scaling
APIs
• as-‐describe-‐launch-‐configs
– Describe
the
specified
launch
configura=ons
if
they
exist.
• as-‐describe-‐scaling-‐ac=vi=es
– Describe
a
set
of
ac=vi=es
or
all
ac=vi=es
belonging
to
a
group,
describing
at
most
max-‐ac=vi=es
at
a
=me.
• as-‐describe-‐triggers
– Describes
a
trigger
including
its
internal
state.
• as-‐set-‐desired-‐capacity
– Set
the
desired
capacity
of
the
specified
auto
scaling
group
(within
the
range
of
group's
minimum
and
maximum
size).
• as-‐terminate-‐instance-‐in-‐auto-‐scaling-‐group
– Terminate
a
given
instance
with/without
reducing
the
group's
capacity.
• as-‐update-‐auto-‐scaling-‐group
– Update
specified
auto
scaling
group
with
aTributes
• as-‐version
12. as-‐create-‐auto-‐scaling-‐group
as-‐create-‐auto-‐scaling-‐group
AutoScalingGroupName
-‐-‐availability-‐zones
value[,value...]
-‐-‐launch-‐configura=on
value
-‐-‐max-‐size
value
-‐-‐min-‐size
value
[-‐-‐cooldown
value
]
[-‐-‐load-‐balancers
value[,value...]
]
[General
Op=ons]
Example:
Create
group
'test-‐group-‐1'
with
required
parameters
(will
have
1
instance
launched
with
config
'test-‐config-‐1')
as-‐create-‐auto-‐scaling-‐group
test-‐group-‐1
-‐-‐launch-‐configura=on
test-‐config-‐1
-‐-‐availability-‐zones
us-‐
east-‐1a
-‐-‐min-‐size
1
-‐-‐max-‐size
1
13. as-‐create-‐launch-‐config
as-‐create-‐launch-‐config
LaunchConfigura=onName
-‐-‐image-‐id
value
-‐-‐instance-‐type
value
[-‐-‐block-‐device-‐mapping
"key1=value1,key2=value2..."
]
[-‐-‐kernel
value]
[-‐-‐key
value
]
[-‐-‐ramdisk
value
]
[-‐-‐group
value[,value...]
]
[-‐-‐user-‐data
value
]
[-‐-‐user-‐data-‐file
value
]
[General
Op=ons]
Example:
Create
a
launch
configura=on
with
name
’testlc'
to
launch
'm1.small'
type
instances
with
imageId
'ami-‐f7c5219e'.
as-‐create-‐launch-‐config
testlc
-‐-‐image-‐id
ami-‐f7c5219e
-‐-‐instance-‐type
m1.small
14. as-‐create-‐or-‐update-‐trigger
as-‐create-‐or-‐update-‐trigger
TriggerName
-‐-‐auto-‐scaling-‐group
value
-‐-‐breach-‐dura=on
value
-‐-‐dimensions
"key1=value1,key2=value2..."
-‐-‐lower-‐breach-‐increment
value
-‐-‐lower-‐threshold
value
-‐-‐measure
value
-‐-‐period
value
-‐-‐sta=s=c
value
-‐-‐upper-‐breach-‐increment
value
-‐-‐upper-‐threshold
value
[-‐-‐namespace
value
]
[-‐-‐unit
value
]
[General
Op=ons]
Example:
Create
a
trigger
with
a
minimal
set
of
parameters.
as-‐create-‐or-‐update-‐trigger
test-‐trigger
-‐-‐auto-‐scaling-‐group
test-‐group
-‐-‐namespace
"AWS/EC2"
-‐-‐
measure
CPUU=liza=on
-‐-‐sta=s=c
Average
-‐-‐dimensions
"AutoScalingGroupName=test-‐group"
-‐-‐period
60
-‐-‐lower-‐threshold
20
-‐-‐upper-‐threshold
80
-‐-‐lower-‐breach-‐increment=-‐1
-‐-‐upper-‐breach-‐increment
1
-‐-‐
breach-‐dura*on
120
15. as-‐create-‐or-‐update-‐trigger
as-‐create-‐or-‐update-‐trigger
TriggerName
-‐-‐auto-‐scaling-‐group
value
-‐-‐breach-‐dura=on
value
-‐-‐dimensions
"key1=value1,key2=value2..."
-‐-‐lower-‐breach-‐increment
value
-‐-‐lower-‐threshold
value
-‐-‐measure
value
-‐-‐period
value
-‐-‐sta=s=c
value
-‐-‐upper-‐breach-‐increment
value
-‐-‐upper-‐threshold
value
[-‐-‐namespace
value
]
[-‐-‐unit
value
]
[General
Op=ons]
Example:
Create
a
trigger
with
a
minimal
set
of
parameters.
as-‐create-‐or-‐update-‐trigger
test-‐trigger
-‐-‐auto-‐scaling-‐group
test-‐group
-‐-‐namespace
"AWS/EC2"
-‐-‐
measure
CPUU=liza=on
-‐-‐sta=s=c
Average
-‐-‐dimensions
"AutoScalingGroupName=test-‐group"
-‐-‐period
60
-‐-‐lower-‐threshold
20
-‐-‐upper-‐threshold
80
-‐-‐lower-‐breach-‐increment=-‐1
-‐-‐upper-‐breach-‐increment
1
-‐-‐
breach-‐dura*on
120
16. Why
Auto
Scaling
Rocks?
• Make
Sure
that
your
applica=on
is
able
to
balance
load
Autonomously.
• No
humans
are
monitoring.
• It
checks
an
awful
lot
of
data
points
every
minute
or
so…
– oh,
we
have
idle
CPU,
let’s
kill
some
instances.
17. Why
Auto
Scaling
Sucks?
• It
takes
some
=me
for
your
EC2
instances
to
launch
=>
LATENCY
• Why
Pay
extra
for
Cloud
Watch
(if
you
don’t
use)
Almost
all
capacity
changes
are
foreseeable.
If
you
had
done
proper
capacity
planning.
• Spikes
• Malicious
traffic
18. Do
you
actually
need
it
?
• Can
you
map
your
traffic
with
machine
proper=es
?
• Do
you
properly
know
your
metrics
to
be
monitored
?
• Do
you
think
that
auto
scaling
fire-‐up
and
shut-‐down
instances
in
=me
?
• Do
you
actually
worry
about
delays
and
other
parameters
?
(what
does
your
applica=on
does)