Top Banner
Level Up Your Web Apps with Amazon Web Services Brian Klaas [email protected] @brian_klaas
65

Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas [email protected] @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

May 21, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Level Up Your Web Apps with Amazon Web ServicesBrian Klaas

[email protected]

@brian_klaas

Page 2: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 3: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 4: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 5: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Oh no, my job security!

Page 6: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 7: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 8: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Good

Fast Cheap

Page 9: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 10: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 11: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 12: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 13: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Hello

Page 14: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

HelloEC2 Route 53 VPC Cloud HSM

Direct Connect

Cloud Formation

Cloud Watch

Data Pipeline

Elastic Bean Stalk

IAMOps

Works

Cloud SearchElastic

Transcoder SES SNS SQS SWF

Dynamo DB

Elasti Cache RDS Redshift

Cloud Front

Glacier S3 Storage Gateway

Kinesis

Cloud Trail

Elastic Map Reduce

IAM

FPS (Payment)

App Stream

Zocalo Work Spaces

CognitoMobile Analytics

Page 15: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

<cffile action=“read” file=“s3://somebucket/somefile.txt” variable=“fileData” />

<cfdirectory action=“list” directory=“s3://somebucket/someDirectory” />

Hello

Page 16: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

S3Hello

Page 17: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

+ =Hello

Page 18: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

CloudFront

Page 19: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

Page 20: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

API HTML/Markup

JS/CSS/Images/Videos User Content

Page 21: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

Progressive Download Streaming HTTP Post

Page 22: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

๏ Geographic distribution of video

๏ Faster downloads

๏ Less traffic on our network

๏ ~3TB transfer/month

April 2016:

$148.96

Page 23: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

1. Set up source

S3 Bucket

EC2 Instance

2. Create a distribution 3. Point distribution to source

4. Use generated DNS entry, or your own

5. Point to CloudFront URLs in your code

Page 24: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Congratulations!Cloud Front

Page 25: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Cloud Front

Versioning

1. Unique names on every change via preprocessor

2. Sign request with new version number

Require CloudFront

Origin Access Identity

Requires signed requests

CTL CloudFront Utils

https://github.com/brianklaas/ctlCloudFrontUtils

Page 26: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

Page 27: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

๏ Email

๏ SMS (US only)

๏ iOS/Android notifications

๏ HTTP/S endpoint

๏ Other AWS services

Page 28: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

= Pub/Sub

Page 29: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

1. Create topic

SNS

2. Authenticated request to create subscription

3. Consumer must confirm subscription

4. Authenticated request to create message

5. All consumers on topic receive message

Page 30: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

Demo

Sending messages to a SNS topic from CF

github.com/brianklaas

Page 31: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

1. Go play in the console 2. Learn about IAM roles and permissions

Things you have to do on your own:

Page 32: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

1. Piphttps://pip.pypa.io/en/stable/installing/

2. Botohttp://boto.cloudhackers.com/en/latest/getting_started.html

3. Set up credentials for boto http://boto.cloudhackers.com/en/latest/boto_config_tut.html

Install pip + boto

Page 33: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

SNS

๏ Email

๏ SMS (US only)

๏ iOS/Android notifications via the Amazon Mobile SDK

๏ HTTP/S endpoint

๏ SQS, Lambda

Page 34: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Page 35: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Page 36: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Page 37: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

No server is easier to manage than no server.

Page 38: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

= Event–driven computing

Page 39: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

<1.5 GB RAM <5 minutes

Page 40: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

2. Upload ZIP1. Write a handler function

3. Invoke an event 4. Handler runs

Page 41: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

= Microservices infrastructure without having to worry about running containers

or scaling your infrastructure!

Page 42: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Logging and Monitoring Third–Party Services

Page 43: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Logging and Monitoring Third–Party Services

?

Page 44: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Logging and Monitoring Third–Party Services

Customer uploads Emits event with file info Processes event

File details

Alert

Page 45: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

Async Image Resizing

Emits event with file info Processes eventHandle customer upload, posts to S3

<cffile action=“write” file=“s3://somebucket/images.zip” /> Calls “done” http endpoint

Multiple sizes written to S3

Page 46: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Video Production Workflow

Lambda

Upload to ingest bucket Processes event

Posts to S3

Launches Elastic Transcoder job Puts encoded files

Processes event

Page 47: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Video Production Workflow (v2)

Lambda

Upload to ingest bucket Processes eventPosts to S3

Launches Elastic Transcoder job Puts encoded files

Processes event

Calls http endpoint Grabs source video Calls transcription API Calls http endpoint Posts to S3

Page 48: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Demo

Invoking Lambda functions from CF

Lambda

github.com/brianklaas

Page 49: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Get the latest AWS Java SDK working in CF10+

Add to your cfinstall/lib directory:

aws-java-sdk-x.x.xx.jar jackson-annotations jackson-core jackson-databind joda-time

Lambda

Page 50: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Lambda

= Focus on building apps, not infrastructure

Page 51: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

DynamoDB

Page 52: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Dynamo DB

= Hugely scalable, high-write throughput document data store

Page 53: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Dynamo DB

4. Write3. Set secondary indexes

2. Set primary and sort keys1. Set read/write capacity

Page 54: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Logging and Monitoring Third–Party Services

Customer uploads Emits event with file info Processes event

File details

Alert

Dynamo DB

Page 55: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Exam Activity Analytics

Capture learner action Writes batch data Stores batch data

Dynamo DB

?QuickSight

Page 56: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Demo

List, Put, Scan, Filter from CF

Dynamo DB

github.com/brianklaas

Page 57: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Preparing for Outages

Page 58: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

The Great DynamoDB Outage of 2015

Outages

Page 59: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Plan for outages.

Outages

(Blame Amazon)

Page 60: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Batch upload from your servers

Outages

Page 61: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Use multiple regions

Outages

Page 62: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Shut off services

Outages

Page 63: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Have a plan.

Outages

Page 64: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

Go Do!

Page 65: Level Up Your Web Apps with Amazon Web Services · Level Up Your Web Apps with Amazon Web Services Brian Klaas bklaas@jhu.edu @brian_klaas. Hello. Hello. Hello. Hello Oh no, my job

[email protected]

@brian_klaas

github.com/brianklaas