-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides.html
185 lines (162 loc) · 4.11 KB
/
slides.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<!-- Uses remarkjs -->
<!-- open this file in a browser to view the slides -->
<textarea id="source">
class: center, middle
# NodeJS on AWS
Robert Friberg
---
# Agenda
* Build a simple app with NodeJS and ExpressJS
* AWS overview
* DynamoDB vs RDBMS comparison
* Deploy app to to Lambda and API Gateway
---
# Javascript in the web browser
* Runs in a "secure" sandbox
* Document Object Model (DOM), document, window, navigator, etc
* Demo browser console (F12 in chrome)
---
# NodeJS
* Independent javascript runtime
* Install from nodejs.org or use nvm
* Server, desktop, docker, AWS Lambda
---
# NodeJS Lab/demo
* Install nvm and node or just node
* Test `node --version`
* Test `npm --version`
* Start interactive, try some statements
* Create and run script hello.js with console.log()
---
# NPM - Node Package Manager
* npmjs.org
* Similar to nuget, maven
* node_modules folder
* Lab/demo - install and use a package
---
# ExpressJS
* Most popular MVC framework for nodejs
* View engines - Jade is now PUG
---
# ExpressJS Lab/demo
* Follow "Getting Started" at expressjs.com
* Installing, Hello World, Generator and Basic Routing
---
# Shorty
* Simple demo application - url shortener like tinyurl or bit.ly
* `git clone https://github.com/rofr/shorty`
* Run the express app in the vanilla-express folder
* Examine the code / make some tweaks
---
# Day 2
* Recap
* AWS Introduction
* DynamoDB
* Lambda
* Api Gateway
---
# Recap
* Javascript
* Node
* npm
* express
---
# AWS Introduction
* PPT Slides from AWS Discovery Day
* Demo/lab: AWS Console create api key, configure aws CLI
---
# DynamoDB
* Distributed key/value store
* Key is a string or number
* Value is a json document
* Simple, fast, scalable
* Eventually consistent
---
# Relational pros
* Powerful queries with SQL
* ACID transactions (Atomic, Consistent, Isolated, Durable)
* Strongly typed schema
* Stored procedures, views
---
# DynamoDB pros
* Scales horizontally (# of items, request rate)
* Unlimited storage
* Fast operations < 10 ms (except scan)
---
# CAP theorem
* Consistency
* Availability
* Partition Tolerance
When there is a network partition, a system can be consistent or available, but not both.
---
# Lab / demo
Implement data access code in shorty
---
# Hosting shorty on AWS
* VMs behind a load balancer ($$$)
* ECS - Elastic Container Service ($$$)
* EKS - Kubernetes ($$$)
* ECS/EKS Fargate (serverless)
* AppRunner
* Elastic Beanstalk
* **API Gateway / Lambda**
* Cloudfront/ S3/ API Gateway / Lambda
---
# API Gateway
* Serverless http/websockets
* Routing to lambda, ec2,
* Authorizers
* API keys
* Throttling
* documentation (openapi specification)
* Generate client
* Versions/stages (staging, prod)
* DEMO: api gateway walkthrough
---
# AWS Lambda
* Serverless compute
* Pay only when the function is executing
* Language runtimes: go, ruby, node, c#, java, python, ?
* Event driven: API Gateway request, s3, dynamo, SQS, SNS
* DEMO: create a function
---
# Shorty problem
* Shorty is built with express.
* Express listens for http on a tcp socket
* API Gateway listens for http and passes event to a function
* Solution: serverless-express npm package
---
# API Gateway Proxy Integration + Single Lambda
* No routing, pass everything on to a single Lambda
* Express integration
* Only one Lambda to manage
* Fewer cold starts
---
# Final lab / demo
* Deploy shorty to lambda api gateway!
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
</html>