An invisible server for the masses
- AWS Account setup
- Permissions for serverless-admin
- Example of processing an S3 image
- API Gateway
- Serverless Application Model (SAM)
- Lambda CLI
- More on Serverless
- More on Clouds
- More about Python
This tutorial aims to have you ending up with a serverless app running in the Amazon cloud – a multi-user to-do list MVC application based on Vue.js.
This is a follow-up to my notes on the ecosystem around the Serverless computing concept.
This page contains notes based on several sources, including Last updated 2017, video course “Build AWS Serverless Web Applications with Python” (3.6) Virtualenv by Ben Lambert covers coding using Visual Studio Code from https://github.com/whelmed/ca-python-serverless.
As with many Serverless running within AWS, the example uses AWS API Gateway. Serverless with Salesforce has input via another API Gateway. Also used in AWS are S3 Buckets to store files, DynamoDB to store documents, and Cognito User Pool to mange user metadata:
AWS Account setup
Obtain an account.
- At the AWS Console, select “DynamoDB”.
- Table Name: “TodoList”
Primary key: Partition key: userId. Add sort key: todoId. Use default settings.
Setup Cognito User Pool
- At the AWS Console, select “Cognito”.
- Pool Name: TodoUserPool. Review defaults.
- Alias attribute: Email address or phone number.
- Menu: App client. Add an app client. App client name: “AppClientForTodoUserPool”
- Uncheck Generate client secret. Creat client app.
Create pool. In “App clients” page, copy App client id.
- At the AWS Console, select “IAM”
- In Users, Add User, “todo_developer”, Programmatic access
Create New Group. “todo-serverless”
- Install awscli
- pem file on local laptop.
Permissions for serverless-admin
Create an Amazon Web Services account. See my tutorial on Amazon on-ramp.
Create a “serverless-admin” user
This is used to do work under an AWS account Administrator Access policy.
- Login to your AWS account
- Go to the Identity & Access Management (IAM) page
- Click on Users
- Click on Create New Users or edit an existing user.
- Enter serverless-admin and click Create
- Click on Download Credentials to download the .csv file with the AWS credentials
- Click Users on the left
- Click on the serverless-admin user
- Go to the Permissions tab
- Click Attach Policy and select the Administrator Access
- Click on Attach Policy
Install Python. See my tutorial on Python interpreter installation on Macs.
Install AWS CLI per https://docs.aws.amazon.com/cli/latest/userguide/installing.html
pip install --upgrade --user awscli
The --upgrade option tells pip to upgrade any requirements that are already installed.
The --user option tells pip to install the program to a subdirectory of your user directory to avoid modifying libraries used by your operating sytem.
pip uninstall awscli
Obtain AWS Access Key ID
Example of processing an S3 image
API Gateway Overview: https://aws.amazon.com/api-gateway/
API Gateway Developer Documentation: https://aws.amazon.com/documentation/apigateway/
Understanding the costs of API Gateway is also crucial. What you see in this course will be within the free tier but once you start playing around with it on your own or you’re using it for production, you may encounter costs.
Check the following link to understand what’s free and what’s not: https://aws.amazon.com/api-gateway/pricing/
Serverless Application Model (SAM)
SAM Github Page: https://github.com/awslabs/serverless-application-model
Using SAM: https://github.com/awslabs/serverless-application-model/blob/master/HOWTO.md
Deploying Lambda Functions (with SAM and even automated!): http://docs.aws.amazon.com/lambda/latest/dg/deploying-lambda-apps.html
New Lambda Layers: http://bit.ly/2TEPC15
- FFmpeg (media processing)
- SOX (Sound eXchange)
- Pandoc (document conversion)
- RSVG (SVG rendering) - (nice work,
- video: Advanced Coding Session and slides (API Gateway authentication use cases, Amazon Kinesis Streams, Amazon Cognito and AWS CloudFormation) by Alex Casalboni of CloudAcademy. repo
- QUIZ: Serverless Architectures on AWS for the Solutions Architect [15m] Jul 22, 2018 by Wayde Gilchrist
AWS Developer: Serverless Architecture and Monitoring 31 Oct 2018 [1h 36m] by Ryan Lewis
Building a Voice-enabled Serverless Website with AWS Polly 10 Jul 2018, 1h 46m by Raluca Bolovan
Play by Play: Build a Serverless Node Web API 9 Apr 2018, 1h 16m by Simona Cotin and John Papa
Using the Serverless Framework with Node.js on AWS 4 Oct 2017, 1h 38m by Fernando Medina Corey (@fmc_sea, fernandomc.com)
More on Serverless
This is one of a series on Serverless computing
- Serverless introduction
- AWS Lambda
- AWS Lambda
- AWS Lambda Serverless
- Cloud regions
- Cloud services comparisons
More on Clouds
This is one of a series on Cloud computing
- Serverless software app development
- SMACK = Spark, Mesos, Akka, Cassandra, Kafka
- Dockerize apps
- Kubernetes container engine
- Hashicorp Vault and Consul for keeping secrets
- Hashicorp Terraform
- Elastic Stack Ecosystem
- Cloud Performance testing/engineering
- Build load-balanced servers in AWS EC2
- AWS Lightsail
- AWS IAM
- AWS IoT
- AWS On-boarding
- AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
- AWS Lambda
- AWS server deployment options
- Google Cloud Platform
- Digital Ocean
- Azure cloud introduction
- Azure Cloud Onramp (Subscriptions, Portal GUI, CLI)
- Azure Cloud Powershell
- PowerShell GitHub API programming
- PowerShell DSC (Desired State Configuration)
- PowerShell Modules
- Microsoft AI in Azure cloud
- Azure cloud DevOps
- Azure Networking
- Azure Storage
- Azure Compute
- Dynatrace cloud monitoring
- AppDynamics cloud monitoring
More about Python
This is one of a series about Python:
- Python install on MacOS using Pyenv
- Python install on MacOS
- Test Python using Pytest BDD Selenium framework
- Python certifications
- Python tutorials
- Python coding notes
- Pulumi controls cloud using Python, etc.
- Microsoft Azure Machine Learning makes use of Python
- Python REST API programming using the Flask library
- Python coding for AWS Lambda Serverless programming
- Streamlit visualization framework powered by Python
- Web scraping using Scrapy, powered by Python
- Neo4j graph databases accessed from Python