Introduction to Amazon Web Services for developers
About presenter
Roman Gomolko with 11 years of experience in development including 4 years of day-to-day work with Amazon Web Services.
Disclaimer
Cloud-hosting is buzz-word for a while and in my talk I would like to give an introduction to Amazon Web Services (AWS).
We will talk about basic building blocks of AWS like EC2, ELB, ASG, S3, CloudFront, RDS, IAM, VPC and other scary or funny abbreviations.
Then we will discuss how to migrate existing applications to AWS. This topic includes:
• how to design infrastructure and services to use when migrating
• how to choose proper instance types
• how to estimate infrastructure cost
• how it will affect performance of application migrated
Then we will make an overview of services provided by AWS and possible apply in your current of future applications:
• SQS
• DynamoDB
• Kinesis
• CloudSearch
• CodeDeploy
• CloudFormation
And if we survive we will talk a little how to design Cloud applications. That’s mainly about general principles.
My talk mostly targeted towards decision makers and decisions pushers of small and medium size companies which are consider “going cloud” or already moving into this direction. Everyone interested in gaining knowledge in these areas are welcomed as well.
We will spend around 2–3 hours together and you will be able to pitch-in any questions until we totally goes away from original plan.
3. UserReport
● Developing products that allow to learn the audience
● Started using AWS more than 5 years ago
● Fully migrated to AWS more than 1.5 years ago
● Processing 3 billions requests monthly
● Generating reports based on 8 billions of requests with batched reports
● Online reports on 300 millions of records
● Used ~50% of services provided by AWS
● Totally happy regarding using AWS
5. Typical Cloud benefits
● Pay for what you are using
● High scalability - retrieve as many resources as you need
● High availability
● Gartner's Hype cycle – cloud computing has reached a maturity
6. Cloud models
● IaaS
Infrastructure like physical (rarely) or virtual servers, storage, networking,
load balancers, IP addresses allocation etc
● PaaS
Hosted databases, pre-configured web-servers that can run your
application, platforms that can run your code
● aPaaS
Tools and services that automates and facilitates utilizing Cloud Services.
Providing tools for development, deployment, monitoring etc
● SaaS
Gmail, MailChimp, Highrise, Google photo, Jira Cloud etc
11. AWS is regional
● Almost all services are region specific
● Pricing of services depends on region
● Not all services are available in all regions
● New services are launching in N. Virginia (US East 1) first
http://aws.amazon.com/about-aws/global-infrastructure/regional-product-
services/
12. Regions are not solid
● Splitted into Availability Zones (AZ)
● AZs have independent power supply
● Cross-AZ network speed is blazing fast
● Some services belong to AZ, some - not
13. Iaas basics
● EC2
Virtual computers managed by XEN running on Intel CPUs
● EBS
SSD or magnetic drives dynamically attached to EC2 instances with
configurable size (up to 16Tb) with configurable IOPs
● ELB
Load balancing before your EC2 instances
● VPC
Creating network and group your instances/services into “Private Cloud”
14. PaaS basics
● CloudFront
CDN for downloading and streaming
● S3
Infinite storage for objects (files) with security and HTTP access
● RDS
Hosted databases like MySQL, MS SQL, PostgreSQL, Oracle, Aurora with
licenses included
● DynamoDB
NoSQL database designed for high performance and availability
15. PaaS basics
● Route53
Fully managed and DNS and domain registration
● ElastiCache
Fully managed hosted memcache and Redis
● SQS
Queue designed for high availability and millions of messages
16. Some more PaaS
● CloudSearch
Search engine for free-text search among millions of documents
● EMR
Fully managed Elastic MapReduce and Spark clusters
● Elastic Transcoder
Encoding media-files in different formats with different quality
● … and more
17. aPaaS
● CloudWatch
Monitoring of your infrastructure and applications
● Elastic Beanstalk
Automated web-applications and workers hosting
● CloudFormation
Manage your cloud services in one place with help of text file
● CodeDeploy
Automates deployment of your application
● OpsWorks
Chef cooked by AWS to automate provisioning and deployment
18. SaaS basics
● SES
Sending e-mails from Cloud
● SNS
Push notifications
● WorkMail
Hosted exchange server for organizations
● WorkSpaces
Virtual office became reality
20. Migration to Cloud
● One bite at a time - migration to Cloud itself is a big deal
● Cloud may have similar services to what you are using in your app. Similar
is not the same.
● Usually you have application which works somehow try to keep your
structure unchanged
● Less efforts, faster migration
31. Connecting to your Linux instance
Linux / Mac OS X
ssh -i "<keypair>.pem" ec2-user@<instance IP>
Windows
● convert .pem to .ppk using Putty KeyGen
● connect to instance using Putty
● refer help for more details
32. Connecting to your Windows instance
● Wait 4-20 minutes after starting instance
● Retrieve password using you keypair
● Use Remote Desktop to connect to your instance. Use Administrator as
name
● Password will expire, better create permanent user
33. Configuring your instance as you like
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
import-module servermanager
add-windowsfeature Web-Server,
Web-WebServer, Web-Security
35. Accessing your web-application
● Your public IP is not static. It will be changed after reboot
● You can request IP address and attach it to instance dynamically
● In future you can assign this IP to another instance
● Put this IP to your DNS or write to host file
41. Wait. Cloud? I need more redundancy
1. Create EC2
2. Connect to it
3. Configure it
4. Stop it
5. Create AMI
6. Launch required number of instances using this AMI
7. Deploy code to them
8. Access website
45. Elastic Load Balancer
● Accept incoming traffic and distribute among instances
● Monitors instance availability
● Can accept HTTPS traffic and map to HTTP endpoint of web-server
● Allows to not expose web-servers to worldwide
● Allows Connection Draining
● Provides useful metrics like latency, requests per minute, count of 2XX,
4XX and 5XX response codes
46. I’ve become popular. Need to scale
Instance roles:
● Web/front-end
● Worker/back-end
● DB
Scaling strategies:
● Vertical scaling
● Horizontal scaling
47. Vertical scaling
● Good if your bottleneck is CPU, RAM or disk
● Can be done with downtime or without it
48. Vertical scaling of EC2.
● Simple - downtime
○ Stop
○ Change instance type
○ Start
● Complex - no downtime
○ Launch new instance with required instance type
○ Switch traffic from old instance to new one
49. Vertical scaling of RDS
● Can be done without downtime in case of Multi-AZ deployment
● Not that fast in any way
56. Finally
● AWS can scale our application automatically looking on CPU load
● AWS can scale-down instances when load decreased
57.
58. Small catch-up
● We know what is EC2 and how to deploy application first time
● We know how to horizontally scale up and down your application
● It looks pretty cumbersome
● We don’t know where we should store users’ files
● We don’t know how to improve website performance
● We don’t know how to update your application
60. Bad reasons to migrate
● Migrating everything by just virtualizing existing stuff and expecting
savings
● Expecting magical performance boost and “Cloud will solve all problems”
61. Good reasons to migrate
● Extremely flexible
● Pay for what you use
o cheap to fail
o cutting cost of testing and applying new technologies
● Fast changes - get what you need when you need
● Allows to focus on your product - not on CDN, Mail sending, file storages,
62. File storage
● DIY - Distributed File System
● Let’s Amazon handle it - Elastic File System (Preview)
● Ready to change code - S3