-
Install SAM CLI:
# macOS brew install aws-sam-cli # Windows # Download from: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html # Verify installation sam --version
-
Install AWS CLI:
# macOS brew install awscli # Or download from: https://aws.amazon.com/cli/ # Verify installation aws --version
-
Configure AWS Credentials:
aws configure
Enter your:
- AWS Access Key ID
- AWS Secret Access Key
- Default region (e.g., us-east-1)
- Output format (json)
-
Install Python & pip (if not already installed):
# macOS brew install python # Verify python3 --version pip3 --version
# Make script executable
chmod +x deploy.sh
# Deploy (will prompt for project name and region)
./deploy.sh# Build only
sam build
# Deploy with guided setup (first time)
sam deploy --guided
# Deploy with existing config
sam deploy
# Local testing
sam local start-api
sam local invoke ImageResizerFunction# Get bucket name from deployment output, then:
aws s3 cp me.jpeg s3://YOUR-INPUT-BUCKET-NAME/
# Check resized images in output bucket
aws s3 ls s3://YOUR-OUTPUT-BUCKET-NAME/resized/ --recursive# Delete entire stack
sam delete --stack-name YOUR-STACK-NAME