Deploy a serverless Express project with a single command.
Have CI/CD - triggers GitHub Actions whenever push to the master branch.
- Express
- AWS Lambda
- AWS Gateway
- AWS ECR
# set_aws_infra_scripts/.env.sh
AWS_ID= #This variable is created automatically
AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_REGION=
DOCKER_REPOSITORY_NAME=
DOCKER_IMAGE_NAME=
ECR_ENDPOINT=$AWS_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$DOCKER_REPOSITORY_NAME
LAMBDA_ROLE_NAME=
LAMBDA_FUNCTION_NAME=
LAMBDA_POLICY_ARN=arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
API_GATEWAY_ID= #This variable is created automatically
API_GATEWAY_NAME=
API_GATEWAY_STAGE=
| KEY | VALUE |
|---|---|
| AWS_ACCESS_KEY | AWS IAM user access key |
| AWS_SECRET_KEY | AWS IAM user secret key |
| AWS_REGION | AWS Region (ex, ap-northeast-2) |
| DOCKER_REPOSITORY_NAME | Name to use for ecr |
| DOCKER_IMAGE_NAME | Name to use for docker image |
| LAMBDA_ROLE_NAME | Name to use for iam lambda role |
| LAMBDA_FUNCTION_NAME | Name to use for lambda function |
| API_GATEWAY_NAME | Name to use for apigateway |
| API_GATEWAY_STAGE | Name to use for apigateway deploy stage |
sh ./set_aws_infra_scripts/main.sh
main.sh : Set initial aws infrastructure
- Make ecr and Push first docker image to ecr
- Make lambda with docker
- Make apigateway and invoke lambda
curl --request GET https://$API_GATEWAY_ID.execute-api.$AWS_REGION.amazonaws.com/dev/hello
- go "github repo > Settings > Secrets and variables > Actions"
- click "New repository secrets"
- copy Keys & Values below to your local .env
AWS_ACCESS_KEY
AWS_ID
AWS_REGION
AWS_SECRET_KEY
DOCKER_IMAGE_NAME
ECR_ENDPOINT
LAMBDA_FUNCTION_NAME
sh ./set_aws_infra_scripts/clear.aws.sh
- Add
.envfile and Fill below content
# .env
NODE_ENV="local"
$ npm i
$ npm run dev
- Excute
.deploy.shfile
$ sh ./deploy.sh
