This repository contains a CloudFormation template that allows you to deploy the following AWS services:
- Amazon S3 Bucket
- Amazon API Gateway
- Amazon Cognito User Pool
It also includes an example demonstrating how to secure an API using token-based authorization powered by Amazon Cognito.
- Automated infrastructure deployment with CloudFormation
- Seamless integration between Cognito and API Gateway
- Token-based authentication using JWTs
- Serverless Framework configuration
- AWS CloudFormation
- AWS API Gateway
- AWS Cognito
- AWS Lambda
- Serverless Framework
- Node.js / Python
├── common/ # Shared resources (IAM roles, policies, etc.)
├── resources/ # CloudFormation resource definitions
├── scripts/ # Helper scripts
├── services/ # Lambda function code
├── serverless.yml # Serverless Framework configuration
├── package.json # Project dependencies
└── README.md # This file
- An AWS account with necessary permissions
- Node.js >= 14.x
- Serverless Framework installed globally
npm install -g serverless
- 🚀 Deployment
Install dependencies:
- Deploy the stack using Serverless:
sls deploy
- After deployment, you will receive the API Gateway endpoint URL protected by Cognito.
This project uses Amazon Cognito for authentication and API protection. To access protected endpoints:
- Register a new user in the Cognito User Pool.
- Authenticate the user and retrieve a JWT token.
- Use the token in the Authorization header when making requests to the API.
Star it if you found it useful ⭐ and feel free to contribute!