Webinar AWS 201 Delivering apps without servers
-
Upload
amazon-web-services -
Category
Internet
-
view
623 -
download
1
description
Transcript of Webinar AWS 201 Delivering apps without servers
![Page 1: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/1.jpg)
AWS$201$
Delivering$Apps$and$Websites$Without$Servers$
Markku$Lepistö$=$Technology$Evangelist$@markkulepisto$
![Page 2: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/2.jpg)
Housekeeping$
• Q&A$using$the$quesHons$panel$during$the$presentaHon$• Reminder$–$Fill$in$the$survey!$
![Page 3: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/3.jpg)
JavaScript!is everywhere. !
![Page 4: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/4.jpg)
AWS SDK for !JavaScript in Node.js !
![Page 5: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/5.jpg)
AWS SDK for !JavaScript in the Browser !
Desktop or mobile devices !
![Page 6: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/6.jpg)
Let’s use them. !
![Page 7: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/7.jpg)
Goals!
1. Learn about AWS SDK for Node.js!
2. Introduce AWS SDK for JavaScript in the Browser!
3. Write a two-tiered web application using JavaScript, HTML, and CSS!
![Page 8: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/8.jpg)
AWS SDK for !Node.js!
![Page 9: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/9.jpg)
Full Service Coverage !Support for over 30 AWS services !
![Page 10: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/10.jpg)
Extensible Clients !Customize any part of the request cycle !
![Page 11: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/11.jpg)
Standard Node.js Idioms !Streams, EventEmitter, Domains!
![Page 12: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/12.jpg)
Open Source !Apache License, Version 2.0 !
http://github.com/aws/aws-sdk-js !
![Page 13: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/13.jpg)
AWS SDK!for Node.js!
30+ Services!Extensible!Idiomatic!Open Source!
![Page 14: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/14.jpg)
Getting Started!AWS SDK for Node.js !
![Page 15: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/15.jpg)
$ npm install aws-sdkBash!
Installing!
![Page 16: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/16.jpg)
var AWS = require(‘aws-sdk’);JS!
Loading !
![Page 17: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/17.jpg)
Configuring!the SDK!AWS.config!
Credentials *!Region *!Extras!
* Required by the SDK!
![Page 18: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/18.jpg)
Configuring Credentials!
IAM roles for EC2 Instances"Environment Variables !File System (outside source control)!
![Page 19: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/19.jpg)
Do Not Hardcode Credentials!
Unless they are read-only and scoped to specific resources. !
![Page 20: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/20.jpg)
IAM Roles for EC2 Instances !
=!Zero Configuration!
![Page 21: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/21.jpg)
Environment Variables !AWS_ACCESS_KEY_ID!AWS_SECRET_ACCESS_KEY!AWS_REGION* !
![Page 22: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/22.jpg)
Configuring!Region and Extras !
![Page 23: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/23.jpg)
AWS.config.update({ region: ‘ap-southeast-1’, // AWS_REGION maxRetries: 10, // default: 3 logger: process.stdout, // ... more options ...});
JS!
![Page 24: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/24.jpg)
AWS.config.loadFromPath(‘./config.json’);JS!
Config From a File !
If this file contains credentials, keep it out of source control !
![Page 25: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/25.jpg)
Working with Services!
![Page 26: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/26.jpg)
Service Objects !
AWS.S3!AWS.EC2!AWS.DynamoDB!AWS.SQS!AWS.SNS!...!
![Page 27: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/27.jpg)
var ec2 = new AWS.EC2([config]);JS!
Constructing a Service Object!
![Page 28: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/28.jpg)
ec2.describeInstances(params, callback);JS!
Calling an Operation !
![Page 29: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/29.jpg)
function (err, data) { ... }JS!
The Callback!
![Page 30: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/30.jpg)
var req = ec2.describeInstances(params);JS!
Getting a Request Object !
![Page 31: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/31.jpg)
var resp = req.send(callback);JS!
Sending the Request Object!
![Page 32: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/32.jpg)
req.on(‘complete’, function(resp) { ... });JS!
Adding Listeners !to the Request Object !
![Page 33: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/33.jpg)
The Request Cycle!
![Page 34: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/34.jpg)
Send AWS.Request !Get AWS.Response !
![Page 35: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/35.jpg)
AWS.Request"
Operation"
AWS.Response"
build! sign! send!
complete!success!
error!
Emitted Lifecycle Events"
... ... ...
Request Lifecycle !
callback!send()!
![Page 36: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/36.jpg)
AWS.Request!.send(callback)!.on(event, callback)!.httpRequest!...!
![Page 37: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/37.jpg)
AWS.Response!
.error!
.data!
.retryCount!
.httpResponse!
...!
![Page 38: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/38.jpg)
Request!Lifecycle !Recap!
Send AWS.Request !Emits Lifecycle Events !Callback with AWS.Response !
![Page 39: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/39.jpg)
Features!of the SDK!
![Page 40: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/40.jpg)
SDK Features!
Global Configuration Object!Bound Parameters !Response Pagination!Event Listeners (Per-Service and Global)!API Version Locking!Secure Credential Management !
![Page 41: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/41.jpg)
Demo!
![Page 42: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/42.jpg)
AWS SDK!for JavaScript!in the Browser !
![Page 43: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/43.jpg)
language!
Getting the SDK !<script src=”https://sdk.amazonaws.com/js/aws-sdk-2.0.18.min.js” />
![Page 44: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/44.jpg)
7 Supported Services!
S3!DynamoDB!SQS!SNS!STS!Kinesis!CloudWatch!
![Page 45: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/45.jpg)
All Modern Browsers!
28.0+! 23.0+! 10+! 17.0+! 5.1+!
![Page 46: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/46.jpg)
Usage is the same. !But in your browser or mobile device !
![Page 47: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/47.jpg)
Configuration!is Different !
![Page 48: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/48.jpg)
Two-Tier Web Applications !
Why is it different?!
![Page 49: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/49.jpg)
Traditional Application Architecture!
Other Services!Node.js Backend !
Your Services!
![Page 50: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/50.jpg)
Two-Tier Application Architecture !
Your Services !
SDK on the Device !
![Page 51: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/51.jpg)
Benefits!
Fewer moving parts!Easy prototyping!Deploying as simple as copying files to Amazon S3 !Fully dynamic app for pennies a month !
![Page 52: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/52.jpg)
Next Level!Web Apps !
![Page 53: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/53.jpg)
App!Ideas!
Forum Software!Blog Commenting Service!Blogging Platform !Firefox/Chrome Extensions !WinRT (Metro Style) Apps!Any Mobile App!!
![Page 54: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/54.jpg)
Let’s Look at a!Web Application!
Using nothing but !HTML, CSS, and JavaScript!
![Page 55: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/55.jpg)
A Simple Blog!Content stored in Amazon DynamoDB !
Assets in Amazon S3 !
![Page 56: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/56.jpg)
Demo!
![Page 57: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/57.jpg)
Key Differences!Three-Tier to Two-Tier !
Browser Security !CORS in the browser Credentials on device !
![Page 58: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/58.jpg)
Cross-Origin Resource Sharing !
![Page 59: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/59.jpg)
CORS!Browser sends pre-flight request to external host.!Host acknowledges browser.!Browser sends XHR request.!
![Page 60: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/60.jpg)
CORS!+ S3!
CORS needs special configuration on Amazon S3.!Configure CORS with bucket policy.!
![Page 61: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/61.jpg)
Configuring CORS on Amazon S3 !
![Page 62: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/62.jpg)
Getting Credentials !Onto Your Device!
![Page 63: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/63.jpg)
Getting!Credentials!
Onto Your Device!
Never hardcode credentials"Use Web Identity Federation !
![Page 64: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/64.jpg)
Web Identity Federation!Use Facebook, Google, or log in with
Amazon as third-party identity providers !
![Page 65: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/65.jpg)
Web Identity Federation!Set up IAM roles for !
these identity providers !
![Page 66: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/66.jpg)
1
2
3
![Page 67: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/67.jpg)
Web Identity Federation!Set up permissions for IAM role !
![Page 68: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/68.jpg)
AWS.config.credentials = new AWS.WebIdentityCredentials({ RoleArn: ‘arn:aws:iam::<ACCOUNT_ID>:role/<ROLE_NAME>’, ProviderId: ‘graph.facebook.com’, WebIdentityToken: fbAccessToken});
JS!
AWS.WebIdentityCredentials !
![Page 69: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/69.jpg)
// 1. Load the FB JS SDK// 2. Call FB.login()FB.login(function (response) { if (response.authResponse) { fbAccessToken = response.authResponse.accessToken; AWS.config.credentials = new AWS.WebIdentityCredentials({...});});
JS!
Get a Facebook Access Token !
![Page 70: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/70.jpg)
Same Concept !For other identity providers !
![Page 71: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/71.jpg)
Amazon Cognito support in!AWS SDKs for JavaScript in !
Node.js & the Browser !Easy Identity Management & Content Sync!
![Page 72: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/72.jpg)
Our Community !
![Page 73: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/73.jpg)
We ♥!Open Source !
![Page 74: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/74.jpg)
https://github.com/ !aws/aws-sdk-js !
![Page 75: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/75.jpg)
Contributing!to the SDK!
Improve Documentation !Report Issues!Submit Pull Requests!Third-Party Plugins!
![Page 76: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/76.jpg)
Third Party Plugins!A great way to add features!
![Page 77: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/77.jpg)
Node.js!
![Page 78: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/78.jpg)
Write More! !
![Page 79: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/79.jpg)
Thank$you$
Markku$Lepistö$=$Technology$Evangelist$@markkulepisto$
![Page 80: Webinar AWS 201 Delivering apps without servers](https://reader034.fdocuments.net/reader034/viewer/2022051513/54705f03b4af9fb90a8b46f5/html5/thumbnails/80.jpg)
Your$feedback$is$important$
Please$complete$the$Survey!$What’s'good,'what’s'not'
What'you'want'to'see'at'these'events'
What'you'want'AWS'to'deliver'for'you'