Date post: | 21-Mar-2017 |
Category: |
Software |
Upload: | michael-haberman |
View: | 403 times |
Download: | 0 times |
AWS introductionMichael Haberman
Freelancer
What we are going to do?
An application Scenario
Before cloud solution
How cloud can help us?
Every cloud talk must start withWhy use cloud?
Before cloud solutions
Registration system
We offer registration infrastructure
That must be highly scalable
The infrastructure has very high load picks
Registration systemFlow:
user authenticates
user send a registration request (once an hour)
application saves it
someone manually accept / reject the request
email is sent
in case of accept - allow print of confirmation (auto generated image)
Solution Architecture
Clients
Web Service
Scale?
Solution Architecture
Clients
Web Service
Web Service
How to balance
the load?
Solution Architecture
Clients
Web Service
Web Service
How to continue scaling?
Load balancer
What happens when the service is
over loading?
Solution Architecture
Clients
Web Service
Web Service
Which machine?
Queue
Who should send
emails?
DB?
Solution Architecture
Clients
Web Service
Web Service
Queue
DB Single DB?
Which machine?
Maybe we need
some cache?
Where to store the images?
Registration system
New requirement:
support Mobile push notification
How does cloud help us?
FeaturesCompute
Storage
Databases
Networking
Mobile support (SNS)
Security
Application Services (Queue, emails, etc…)
Developer Tools (Git, CI)
Management Tools
Analytics
Enterprise Applications
Let’s see the AWS Console
Cloud Solution
Clients
Web Service
Web Service
Queue
DB
Open Issues:DB
(replication)Push
notificationImagesCacheSend Emails
Choosing Database(SQL)
First thought:
EC2 - with a DB Instance
What benefit do we gain by using a cloud base server with DB Instance on it?
Choosing Database(SQL)
EC2 - might not be the first choose for DB
You pay for compute, storage, ram and etc…
Storage is expensive
You have to maintain the DB
Taking responsibility on backups
You have an entire machine only to get a connection string
Choosing Database(SQL)
RDS - Rational Database Services
All you get is a connection string
Auto maintenance
Auto backups
Replication support
Paying for storage (only what you use vs EC2)
Auto address swap in case of failure
DynamoDBSolution for noSQL databases
Cloud Solution
Clients
Web Service
Web Service
Queue
RDS
Open Issues:DB
(replication)Push notificationImagesCacheSend Emails
Auto Scale?
Load balanc
e?
EC2 - Auto ScaleDefine a threshold using CloudWatch
Add instance when event occur
Remove instance when event occur
Define min/max/desired amount of instances
Register for notification (load tests…)
EC2 - Load Balancer
The Auto Scale will create instances upon high loads
The Load Balancer will keep an equal load in the instances
very easy to define
Cloud Solution
Clients
EC2 EC2
Queue
RDS
Open Issues:DB
(replication)Push notificationImagesCacheSend Emails
Load Balancer + Auto Scale
ElasticCacheFew EC2 instance may require high speed data sharing
Distributed cache would solve that
A key value pair
Expiration is supported (once an hour)
When new instance is created - state is easily preserved
ElasticCachevar params = {
ResourceName: 'STRING_VALUE', /* required */
Tags: [ /* required */
{
Key: 'STRING_VALUE',
Value: 'STRING_VALUE'
},]};
elasticache.addTagsToResource(params, function(err, data) {
});
Cloud Solution
Clients
EC2 EC2
Queue
RDS
Open Issues:DB
(replication)Push notificationImagesCacheSend Emails
Load Balancer + Auto Scale
Cloud Front
SQS - Simple Queue Service
Pay as you go
No need for dedicated machine
Simple API
Dead letter queue support
SQS - Enqueuevar params = {
MessageBody: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE', /* required */
MessageAttributes: {
someKey: {
DataType: 'STRING_VALUE', /* required */
StringValue: 'STRING_VALUE'
},}} ;
sqs.sendMessage(params, function(err, data) {
});
SQS - Dequeuevar params = {
QueueUrl: 'STRING_VALUE', /* required */
NumberOfMessages: 0,
VisibilityTimeout: 0,
WaitTimeSeconds: 0
};
sqs.receiveMessage(params, function(err, data) {
});
Security!
Cloud Solution
Clients
EC2 EC2
SQS
RDS
Open Issues:DB
(replication)Push notificationImagesCacheSend Emails
Load Balancer + Auto Scale
Cloud Front
Cloud Storage Solutions
EC2
high cost
better performance when in the same machine
S3
low cost
distributed between different services
Glacier
low performance - archive Which one would you
use?
S3S3
Separated into buckets
Each item can be up to 5 terabyte
Support event notification (upon item add send email)
Encryption support
S3 - SDKvar params = {
Bucket: 'STRING_VALUE', /* required */
Key: 'STRING_VALUE', /* required */
Body: new Buffer('...') || 'STRING_VALUE' || streamObject,
Expires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
Metadata: {
someKey: 'STRING_VALUE',
}};
s3.putObject(params, function(err, data) {
});
Cloud Solution
Clients
EC2 EC2
SQS
RDS
Open Issues:DB
(replication)Push notificationImagesCacheSend Emails
Load Balancer + Auto Scale
Cloud Front
S3
Event notification
S3
upon change use SNS, SQS, Lambda events
in our example, send an email. How?
Lamba events
S3
upon change use SNS, SQS, Lambda events
in our example, send an email. How?
Cloud Solution
Clients
EC2 EC2
SQS
RDS
Open Issues:DB (replication)Push
notificationImagesCacheSend Emails
Load Balancer + Auto Scale
Cloud Front
S3LambdaSES
SNS
AWS - endless featureGIT
Deployment
CDN
Monitoring
Analytics
Questions?
Contact Me
Website: www.haberman.io
Email: [email protected]
Twitter: @hab_mic
Blog: http://blogs.microsoft.co.il/michaelh/