A serverless API for picking up famous quotes, with AWS Lambda and DynamoDB. The deployment process is done by Serverless framework. Please also refer to quote-with-you repository for grasping entire application.
Product Link: https://quote2you.yutafujii.net
- Install serverless
$ yarn --global add serverless
- code
- deploy it
Deploy command:
$ sls deploy
This will create CloudFormation JSON and create resources below:
- AWS Lambda
- API Gateway HTTP API
- DynamoDB (1 table)
Where to execute this command depends on how you want to deploy it.
Please make sure you're configured the following environment variable:
export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>
If those are set, run sls deploy
to deploy.
When you push something to master
branch, Github action fires sls deploy
command.
Please make sure you're configured the following environment variable in CircleCI:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
NOTE
Because this is a pet project, there's no staging/development configuration.
If you want those CI/CD pipeline, configure .circleci/config.yml
file.
sls invoke local -f function-name -p event.json
Run lambda function locally, create event.json
and
$ sls invoke local -f function-name -p event.json
To generate Cloudformation file without deploy, run
$ sls package
# this generates json files in .serverless/ directory
In a real situation, you might also want to make those APIs available to public.
- Purchase your own domain
- Set custom domain to API gateway
- Add record to your host (Route53)