This is a basic tech experience to build auto scale with AWS shared from LIVEhouse.in. The slide also includes how we coordinate auto scaling and the release deployment.
5. “Methods of adding more resources for a particular
application fall into two broad categories:
horizontal and vertical scaling.
http://en.wikipedia.org/wiki/Scalability
Michael, Maged; Moreira, Jose E.; Shiloach, Doron; Wisniewski, Robert W. (March 26, 2007).
"2007 IEEE International Parallel and Distributed Processing Symposium"
6. Scale Vertically
▸ Scale up and down
about SCALABILITY
Scale Horizontally
▸ Scale out
scale up
scale down
1
4
14. Amazon EC2
▸ Amazon Elastic Compute Cloud
○ “A web service that provides resizable compute
capacity in the cloud”
○ “Designed to make web-scale cloud computing
easier for developers”
■ Scale up/down; start, stop, terminate...etc.
EASY management with a great UI.
15. AMI
▸ Amazon Machine Images
○ “A template for the root volume for the instance
(for example, an operating system, an
application server, and applications)”
A script of an instance.
17. AWS CLI
▸ AWS Command Line Interface
○ “A unified tool to manage your AWS services”
■ AWS CLI and AWS EC2 CLI
■ Github
● aws/aws-sdk-ruby
● aws/aws-cli
○ Access key
■ AWS Identity and Access Management (IAM)
API.
18. Process of Launching Instance
Launch instance
using image
Allocate IP
Associate IP
with instance
19. `ec2-run-instances #{AMI_ID} #{REGION}
#{GROUP} #{SUBNET} #{INSTANCE_TYPE}
#{BLOCK_DEVICE_MAPPING}`
Launch an Instance Using an Image.
launch
instance
Image
ID
security
group
small?
large?
additional
store volume
26. Do All in One
▸ Pros
○ Simple flow
▸ Cons
○ Legacy > 5 mins
Facts that matter
Break Things Down
▸ Pros
○ Flexible to handle
▸ Cons
○ Different entries by
time
It takes 5 minutes to run an instance up
process
launch + IP
go online
process
27. Process of Terminating Instance
Disassociate IP
from instance
Release IP
Terminate
instance
32. AWS ELB
▸ Elastic Load Balancing
○ “Automatically distributes incoming application
traffic across multiple Amazon EC2 instances in
the cloud.”
Traffic-monitoring UI and the metrics.
Icon made by Freepik from www.flaticon.com is licensed under CC BY 3.0
35. `elb-deregister-instances-with-lb #
{LOAD_BALANCER} #{INSTANCE_ID} #{REGION}
#{CREDENTIAL_FILE}`
Cut Instance out from Load Balancer.
aws elb register-instances-with-load-balancer --load-balancer-name
my-test-loadbalancer --instances i-4e05f721
OUTPUT>
{"Instances": [{"InstanceId": "i-315b7e51"}]}
from Amazon doc
36. `aws elb describe-instance-health #
{LOAD_BALANCER} #{REGION}`
Returns the current state of the instances
registered with the specified load balancer.
38. `mon-get-stats #{METRIC} #{NAMESPACE}
#{STATISTICS} #{REGION} #{DIMENSIONS}
#{CREDENTIAL_FILE}`
Get time-series data for one or more statistics
of a given Metric.
get time-series
data
requestCount,
HTTPCode_Backend_2XX, ...
aws/elb
sum
lb name
42. Amazon ElastiCache
▸ Amazon ElastiCache
○ “makes it easy to deploy, operate, and scale an
in-memory cache in the cloud”
Redis, a key-value database.
43. Redis
“Redis is an open source, BSD
licensed, advanced key-value
cache and store. ”
- http://redis.io
Different data structures:
strings, hashes, lists, sets, ...
Icon made by Carlos Prioglio from www.iconfinder.com is licensed under CC BY-NC-SA 3.0
51. Watch for Status
▸ Now what should be done?
○ Add/remove instance
■ Number of online-servers
■ Traffic and threshold
○ Register/deregister instance with load balancer
○ Update instance status
■ pending / Initializing / running / stop / problem
○ White List
○ Limitation
■ Time
■ Scaling
Icon made by Freepik from www.flaticon.com is licensed under CC BY 3.0
52. Track Things Down
▸ Online instances
▸ Waken instances
▸ Problem instances
Redis data type: List.
i-abcde01
i-bcdef02
i-cdefg03
53. Track Things Down
▸ Instance information
▸ The timestamp of the last instance
initialized
Redis data type: String.
i-abcde01: "{id: i-abcde01,
status: initializing,
private_ip: 192.168.0.1,
public_ip: 54.12.23.34,
created_at: 2015/01/20 14:03:00}"
57. Always put the NEWEST service online.
Icon made by OCHA , icon made by Freepik, icon made by Sarfraz Shoukat from www.flaticon.com is licensed under CC BY 3.0
Icon made by Charles Lowell and Frontside from jenkins-ci.org is licensed under CC BY-SA 3.0
67. Credits
Special thanks to all the people who made and released
these awesome resources for free:
▸ Busy Icons by Olly Holovchenko
▸ Presentation template by SlidesCarnival
▸ Photographs by Unsplash
▸ Paper backgrounds by SubtlePatterns
▸ Other icons are from
▸ http://www.freepik.com
▸ http://www.flaticon.com
▸ https://livehouse.in
▸ http://jenkins-ci.org