Be curious not jugdemental
Be curious not jugdemental

Serverless basics

MW
Martin Wieser

Create your own lambda layer

python
Create thanks to this how-to from
Or
how-to
How to build a lambda layer
pip install
--platform manylinux2014_x86_64 \
--target=my-lambda-function \
--implementation cp \
--python 3.8 \
--only-binary=:all: --upgrade \
pandas?
?
pip install \
--platform manylinux2014_aarch64 \
--target=./python/lib/python3.9/site-packages \
--implementation cp \
--python 3.9 \
--only-binary=:all: --upgrade \
pandas

Pre built layers

Sklearn
lambda layers
GDAL lambda
Ai lambda layer
collection

Public s3 bucket

Serverless Finch

client:
bucketName: ${self:custom.bucket}
distributionFolder: static
bucketPolicyFile: ./bucket-policy.json
keyPrefix: playground
indexDocument: index.html
errorDocument: error.html
serverless client deploy --no-delete-contents --stage staging --verbose

S3 deploy

assets:
auto: true
targets:
- bucket: ${self:custom.bucket}
Ref: StorageBucket
prefix: playground
files:
- source: static/
globs: '**/*.html'

Bucket Config

resources:
Resources:
StorageBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: ${self:custom.bucket}
PublicAccessBlockConfiguration:
BlockPublicAcls: false
OwnershipControls:
Rules:
- ObjectOwnership: ObjectWriter
###
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
CorsConfiguration:
CorsRules:
- AllowedMethods:
- GET
- PUT
- POST
- HEAD
AllowedOrigins:
- "*"
AllowedHeaders:
- "*"

Create Distribution

Choose bucket
Change name
Activate WAF
Add CNAME
Choose Certificate
Add logging
image.png
image.png

image.png

Edit config

enable website endpoint
add index.html
image.png
image.png

Configure Cloudflare

image.png

Install aws cli

Mutiple profiles


aws configure --profile profileName


Useful Links

Automatically add a domain

Configure CloudFront

Serverless Offline

Lambda python requirements

AWS Lambda runtimes

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.