Simple ETL (AWS Emulator)
This guide shows you how to build a file processing pipeline using AWS S3, Lambda, and DynamoDB locally with AWS Emulator, the official local emulator from AWS, and Python. This lab demonstrates how S3 uploads trigger a Lambda to log metadata into a DynamoDB table.
Prerequisites
Section titled “Prerequisites”- Docker installed and running.
- Dev Containers extension installed (optional).
- AWS Toolkit for VS Code (optional, included in Dev Container).
How to execute
Section titled “How to execute”Run every script through mise: mise run <task> loads .env, removes any real AWS credentials from the environment and puts the lab tools on the PATH.
-
Setup Environment:
Open VS Code in the project folder and execute this command in the Command Palette:
Terminal window > Dev Containers: Reopen in ContainerIt builds the AWS Emulator image, installs the tools and deploys the pipeline with Boto3.
- Start Infrastructure: Build and launch AWS Emulator, and wait until it is healthy.
Terminal window docker compose up -d --wait aws-emulator - Run the setup script to install tools and dependencies, and deploy the pipeline with Boto3.
Terminal window scripts/setup.sh
- Start Infrastructure: Build and launch AWS Emulator, and wait until it is healthy.
-
Run the Example:
Terminal window mise run mainTerminal window mise exec -- aws s3 cp README.md s3://file-uploads-bucket/README.md
How to debug
Section titled “How to debug”-
main.py:
- Open: Open
main.py. - Breakpoints: Set breakpoints in the code.
- Run: Press
F5to start debugging.
- Open: Open
-
Tests:
- Open: Open
tests/test_file_pipeline.py. - Breakpoints: Set breakpoints in the test code.
- Run: Use the VS Code Testing tab and click the Debug Test icon next to the test.
- Open: Open
How to test
Section titled “How to test”The tests deploy their own pipeline (names in .env.test) and remove it afterwards.
- Individually: Run tests individually from the VS Code Testing tab.
- All tests: Run the automated script:
Terminal window mise run test
Deployment methods
Section titled “Deployment methods”The setup deploys the pipeline with Boto3. Before deploying with another method, run mise run destroy:boto3 to avoid resource name conflicts, and when switching between the other methods, run Clean Up for the current one first.
mise run deploy:terraformmise run deploy:cloudformationmise run deploy:boto3mise run deploy:aws-cliValidate results
Section titled “Validate results”- Verify that the AWS CLI reaches the emulator (account
000000000000):Terminal window mise exec -- aws sts get-caller-identity - Check S3 Bucket:
Terminal window mise exec -- aws s3 ls s3://file-uploads-bucket - Scan DynamoDB Table:
Terminal window mise exec -- aws dynamodb scan --table-name file-logs - View Lambda Logs:
Terminal window mise exec -- aws logs tail /aws/lambda/s3-file-processor
In the Dev Container, the AWS Toolkit uses the default profile that AWS Emulator writes in .aws/emulator/.
- Connect: Select the
defaultprofile and theus-east-1Region in the AWS Toolkit. - S3: Expand the S3 section to see the uploaded files.
- CloudWatch: Expand the Logs section to see the Lambda execution output.
Clean Up
Section titled “Clean Up”To remove only the deployed resources, run the destroy script of the method you used:
mise run destroy:terraformmise run destroy:cloudformationmise run destroy:boto3mise run destroy:aws-cliTo remove everything, stop the emulator (it keeps all resources in memory) and delete its image:
docker compose down --rmi localTroubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
Could not connect to the endpoint URL or SSL errors | Run AWS CLI commands with mise exec -- aws ... from the lab root, so they load .env, and check that the emulator is healthy with docker compose ps. |
AccessDenied: Sign the request with the emulator credentials | Real AWS credentials in your environment take precedence. Run commands with mise run or mise exec, which remove them. |
| Resources are gone | AWS Emulator keeps resources in memory, so a restart deletes them. Deploy again. For Terraform, delete deploy/terraform/terraform.tfstate first. |
| Lambda not triggering | Check the logs with mise exec -- aws logs tail /aws/lambda/s3-file-processor. |
| AWS Toolkit cannot connect after a restart | The emulator creates a new certificate on each start. Run Developer: Reload Window in VS Code. |