forked from warsawjs/meetup-slides-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
330 lines (270 loc) Β· 10.6 KB
/
index.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<!DOCTYPE html>
<html lang="en">
<head>
<title>WarsawJS Meetup: Secure Static Site on AWS</title>
<meta charset="utf-8"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<meta name="viewport" content="width=device-width"/>
<link href="images/icons/warsawjs-logo-transparent-32x32.png" rel="icon" type="image/png" sizes="32x32"/>
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,900&subset=latin-ext" rel="stylesheet"/>
<!-- Shower Theme -->
<link rel="stylesheet" href="vendors/shower-ribbon/styles/screen-16x9.css"/>
<link rel="stylesheet" href="vendors/shower-warsawjs/styles/main.css"/>
<!-- Prism.js -->
<link rel="stylesheet" href="vendors/prism/prism.css"/>
<link rel="stylesheet" href="vendors/prism/custom-prism.css"/>
</head>
<body class="shower list">
<header class="caption">
<h1>Secure static site on AWS - S3, CloudFront, Terraform and Lambda@Edge</h1>
<p>How to host secure static website with just a couple of tools</p>
</header>
<section class="slide front-page">
<div class="logo">
<!-- Logo WarsawJS -->
<img src="vendors/shower-warsawjs/images/logo.svg" width="350" alt=""/>
</div>
<div class="details">
<!-- 1. Avatar -->
<img src="images/avatar.JPG" height="200" alt="Speaker"/>
<!-- 2. Speaker -->
<h2>Karol Kozakowski</h2>
<!-- 3. Presentation title -->
<h2><strong>"Secure static site on AWS - S3, CloudFront, Terraform and Lambda@Edge" [EN]</strong></h2>
<!-- 4. Presentation date -->
<h2>2020-03-11</h2>
<!-- 5. Contact the speaker -->
<h2><a href="http://twitter.com/cosaquee">@cosaquee</a></h2>
</div>
</section>
<section class="slide compact">
<h2>Agenda</h2>
<ol>
<li>Who am I?</li>
<li>Dynamic runtime vs static hosting</li>
<li>Baseline security requirements</li>
<li>Tools that we are using
<ul>
<li>Terraform</li>
<li>CloudFront</li>
<li>Lambda@Edge and CSP</li>
</ul>
</li>
</ol>
</section>
<section class="slide compact">
<h2>Who am I?</h2>
<ol>
<li>Karol Kozakowski</li>
<li class="next">DevOps Engineer</li>
<li class="next">I like to talk about everything programming related</li>
<li class="next">@Artificiallabs</li>
<li class="next">AWS, Cloud, Security</li>
</ol>
<p class="note next"> Secure static site on AWS </p>
</section>
<section class="slide">
<h2>Dynamic vs static</h2>
<img src="https://media.giphy.com/media/xT9KVwVraalcvmKBfW/source.mp4" alt=""/>
</section>
<section class="slide compact">
<h2>Dynamic runtime</h2>
<img class="next" src="./images/dynamic-simple.png" height="400">
</section>
<section class="slide compact">
<h2>DNS based load balancing</h2>
<img class="next" src="./images/dynamic-dns.png" height="400">
</section>
<section class="slide compact">
<h2>Using load balancing</h2>
<img class="next" src="./images/dynamic-balancer.png" height="400">
</section>
<section class="slide compact">
<h2>Horizontal scaling</h2>
<img class="next" src="./images/dynamic-full.png" height="400">
</section>
<section class="slide">
<h2>Static hosting</h2>
<img class="next" src="./images/static.png" height="300">
</section>
<!-- <section class="slide compact">
<h2>Dynamic runtime</h2>
<ol>
<li class="next">Cost</li>
<li class="next">Security issues</li>
<ol>
<li class="next">Updates</li>
<li class="next">Upgrades</li>
</ol>
<li class="next">Scalability and handling spikes</li>
<li class="next">Keeping things running</li>
</ol>
</section> -->
<section class="slide compact">
<h2>Adventages of static hosting</h2>
<ol>
<li class="next">"Almost" free</li>
<li class="next">Sane defaults out-of-the-box</li>
<li class="next">Much more scalable</li>
<li class="next">No need to manage servers</li>
</ol>
</section>
<section class="slide compact">
<h2>Requirements</h2>
<ol>
<li class="next"><strong>Always</strong> use HTTPS</li>
<li class="next">Content Security Policies</li>
<li class="next">Content Delivery Network</li>
</ol>
</section>
<section class="slide compact">
<h2>Tools that we are using</h2>
<ul>
<li class="next">Terraform to manage cloud resources</li>
<ul class="next">
<li class="next">Serverless</li>
<li class="next">CloudFormation</li>
<li class="next">AWS CDK (Cloud Development Kit)</li>
</ul>
<li class="next">S3</li>
<li class="next">CloudFront</li>
<ul class="next">
<li>Cloudflare with Edge Computing</li>
</ul>
<li class="next">Lambda@Edge</li>
</ul>
</section>
<section class="slide prism">
<h2>Terraform - Infrastructure as a Code</h2>
<pre style="font-size: 20px;" class="language-javascript">
<code>
resource "aws_s3_bucket" "warsaw_js" {
bucket = "warsawjs.com"
acl = "public-read"
policy = "${file("policy.json")}"
website {
index_document = "index.html"
error_document = "error.html"
}
}
</code>
</pre>
</section>
<section class="slide">
<h2>CloudFront</h2>
<ul>
<li class="next">Global Scale - 205 Edge Location </li>
<li class="next">Integrates with existing AWS services
<ul>
<li class="next">ACM - SSL certificates for free</li>
<li class="next">WAF - Web Application Firewall</li>
<li class="next">CloudWatch - Monitoring and Alerting</li>
</ul>
</li>
<li class="next">Lambda@Edge - Run Lambda functions at the Edge</li>
</ul>
</section>
<section class="slide">
<h2>Lambda@Edge and Cloudfront</h2>
<div class="double">
<img src="./images/[email protected]" height="300">
<ul>
<li>Viewer Response</li>
<li>Viewer Request</li>
<li>Origin Request</li>
<li>Origin Response</li>
</ul>
</div>
</section>
<section class="slide prism">
<h2>Content Security Policy </h2>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
Content-Security-Policy: default-src 'self'
</code>
</pre>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
Content-Security-Policy: default-src 'self' *.trusted.com
</code>
</pre>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
Content-Security-Policy: default-src 'self'; script-src 'unsafe-inline'; connect-src api.mydomain.com; style-src *.mydomain.com; report-uri https://csp.example.com;
</code>
</pre>
<p class="note next">https://developers.google.com/web/fundamentals/security/csp/</p>
</section>
<section class="slide prism">
<h2>Lambda@Edge</h2>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
exports.handler = (event, _, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
headers = ?
callback(null, response);
};
</code>
</pre>
</section>
<section class="slide prism">
<h2>Cache Control</h2>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
headers["cache-control"] = [
{
key: "Cache-Control",
value:
"max-age=0, must-revalidate, no-cache, no-store, post-check=0, pre-check=0, private"
}
];
</code>
</pre>
</section>
<section class="slide prism">
<h2>HSTS</h2>
<pre style="font-size: 20px;" class="language-javascript next">
<code>
headers["strict-transport-security"] = [
{
key: "Strict-Transport-Security",
value: "max-age=15552000; includeSubdomains; preload"
}
];
</code>
</pre>
</section>
<section class="slide prism">
<h2>Content Security Policy</h2>
<pre style="font-size: 15px;" class="language-javascript next">
<code>
headers["content-security-policy"] = [{
key: "Content-Security-Policy",
value: "Content-Security-Policy: default-src 'none'; script-src https://cdn.mybank.net; style-src https://cdn.mybank.net; img-src https://cdn.mybank.net; connect-src https://api.mybank.com; child-src 'self'"
}];
</code>
</pre>
</section>
<section class="slide compact">
<h2>Questions?</h2>
</section>
<section class="slide">
<h3 class="shout">See you next month at WarsawJS</h3>
</section>
<div class="progress"></div>
<footer class="badge">
<a href="https://github.com/warsawjs/warsawjs-slides-template">Fork me on GitHub</a>
</footer>
<footer class="badge badge-top-left">
<a href="#" class="fullscreen">Fullscreen</a>
</footer>
<script src="vendors/gamepad/gamepad.js"></script>
<script src="vendors/shower/shower.min.js"></script>
<script src="vendors/shower-gamepad/shower.gamepad.js"></script>
<script src="vendors/shower-warsawjs/scripts/fullscreen.js"></script>
<!-- Prism.js -->
<script src="vendors/prism/prism.js"></script>
<script src="vendors/prism/custom-prism.js"></script>
</body>
</html>