This repository contains an AWS lambda + API gateway hello world application.
It's using awesome Serverless framework to deploy (almost) all infrastructure needed.
That's the most scalable hello world I've ever created.
Memetic Poetic Licence, not actually true
- https://dev.cintia.me: hello world endpoint
- https://dev.cintia.me/healthcheck: health check (!)
- https://dev.cintia.me/metadata: Basic application information, like git commit and version (imported from package.json)
AWS requirements(conf.json):
- ACM Certificate
- Route53 DNS zone
Local requirements:
- AWS cli and credentials to deploy
- Node 10.x (can be via
nvm use
) ./scripts/install.sh
to install all dependencies
# Build cloudformation for dev
$ ENVIRONMENT=dev npm run package
# Deploying to dev
$ ENVIRONMENT=dev npm run deploy
# Running smoke tests against dev
$ ENVIRONMENT=dev npm run smoke-tests
Travis is configured to deploy branch production
to the production environment.
This branch should be pushed locally.
(Yes, technically this breaks the whole concept of a proper pipeline, but that's the way travis works.)
$ ./scripts/push-prd.sh
- This code is in node due to the better integration with serverless framework, but I'm not a node expert. Take my code with a pinch of salt;
- Lambda is running outside VPC; security considerations apply if your lambda handles sensitive data;
- Memory size and timeout are not being configured;
- Environment variables are not encrypted, same security considerations;
- There's no dashboards nor alarms for failures. Also, no dead letter queue configured for failures, nor AWS Xray.
- There's no de-duplication mechanism for lambda because they are not changing state. Check this blogpost for details;
- Logs and basic metrics are automatically deployed to cloudwatch by default;
- There are no unit nor integration tests because the hello world is very basic, but you should check Serverless Testing guide if your lambda is more complex than that. Serverless offers a lot of help for local tests and debugging;
- Smoke tests are done using Jasmine framework;