This repository demonstrates deploying a Strawberry GraphQL application to AWS Lambda using serverless architecture.
Ensure the following tools are installed:
- Python
- Install Python 3.12+
- Amazon Web Services (AWS)
- Create a Free Tier AWS Account
- Install AWS CLI
- Configure AWS CLI with your AWS Access Key ID and Secret Access Key
- Install AWS Serverless Application Model (AWS SAM)
On your terminal, run the following commands:
# Clone repository
git clone git@github.com:mel-cdn/serverless-python-strawberry-graphql-aws-lambda.git
cd serverless-python-strawberry-graphql-aws-lambda
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r src/requirements.txt
# Run locally
./run-local-service.sh
# Access on your browser
http://localhost:8000/Using AWS SAM
# Verify SAM installation
sam --version
# Export your AWS profile
export AWS_PROFILE="your-aws-profile-name"
# Build
sam build
# Deploy
sam deploy --guided
# Check the deployed API
aws apigatewayv2 get-apis
{
...,
"ApiEndpoint": "https://<your-api-id>.execute-api.ap-southeast-1.amazonaws.com",
...,
}