-
Create an AWS Account and configure credentials for terminal
-
VpcConfig needs to be configured on template.yml (Optional, you can also delete this part.)
# Build handler executable for Linux
GOOS=linux GOARCH=amd64 go build
Run the serverless application locally for quick development and testing.
This command uses template.yml
file as a reference.
sam local start-api
export REGION="<REGION>"
export S3_BUCKET="<BUCKET_NAME>"
export STACK_NAME="<STACK_NAME>"
# If you already have a S3 bucket skip below command
aws s3 mb --region $REGION s3://$S3_BUCKET
sam package \
--template-file template.yml \
--s3-bucket $S3_BUCKET \
--region $REGION \
--output-template-file packaged.yml
sam deploy \
--template-file packaged.yml \
--stack-name $STACK_NAME \
--capabilities CAPABILITY_IAM \
--region $REGION \
--parameter-overrides AppId="test"
The --parameter-override
option is not required, also can be specified on template.yml.
sam delete \
--stack-name $STACK_NAME \
--region $REGION \
--no-prompts
aws s3 rb s3://$S3_BUCKET --force