Light-weight sample to show how to use the AWS Serverless Application Model (AWS SAM) to integrate API Gateway to a separate Swagger or OpenAPI file. The demo triggers a lambda function through API gateway, and then returns the parameters passed to it to show that you can acces these parameters inside the lambda function.
- Create an AWS Account Link
- Take note of your AWS Access Key ID, AWS Secret Access Key and 12-digit account ID
- Install AWS CLI Commands Link
- If you don't know which default region name to indicate, just set it to us-east-1
- Configure your local PC Link
- Install AWS SAM Commands Link
- Clone or download this repository.
- Replace AWS_REGION and ACCOUNT_ID in the swagger.yaml file.
... arn:aws:lambda:AWS_REGION:ACCOUNT_ID:function:PostPetFunction/invocations ... arn:aws:lambda:AWS_REGION:ACCOUNT_ID:function:GetPetFunction/invocations
- Replace UNIQUE_NAME deploy.sh and remove.sh files with some unique name.
Important: Bucket names must be unique for all AWS users.
BUCKET="pet-store-api-deployment-workspace-UNIQUE_NAME"
- Run the following commands on your terminal:
Expected output:
$ cd aws-sam-swagger-apigateway-lambda-starter $ sh ./deploy.sh
> ... > Successfully created/updated stack - pet-store-stack
- Perform the following commands:
Expected output:
$ cd aws-sam-swagger-apigateway-lambda-starter $ sh remove.sh
> ... > remove_bucket: pet-store-api-deployment-workspace-UNIQUE_NAME