A demonstration project showcasing AWS Secrets Manager integration with a Go application, containerized using DevPod for development.
- Application: Go HTTP server that retrieves secrets from AWS Secrets Manager
- Containerization: Docker with multi-stage build for minimal image size
- Development: DevPod for consistent development environment
- Testing: Go test framework with HTTP endpoint testing
- Go 1.22 or later
- Docker Desktop
- DevPod CLI
- AWS CLI with configured credentials
- Task (taskfile.dev)
.
├── main.go # Main application code
├── main_test.go # Test cases
├── Dockerfile # Multi-stage Docker build
├── devcontainer.json # DevPod configuration
├── Taskfile.yaml # Task automation
└── README.md # Project documentation
- Install DevPod:
task setup:devpod- Start the development workspace:
task devpod:upThe project uses DevPod for development, providing a consistent environment with:
- Go toolchain
- AWS CLI
- Docker-in-Docker
- VS Code extensions
- Hot Reloading: Using Air for development
- Testing: Integrated test framework
- Containerization: Optimized Docker build
- AWS Integration: Secrets Manager access
- Start the development server:
task dev- Run tests:
task test- Build the Docker image:
task docker:build- Run the container:
task docker:runThe project includes:
- HTTP endpoint testing
- AWS Secrets Manager integration tests
- Test coverage reporting
Run all tests:
task test:devpodAWS_SECRET_NAME: Name of the secret to retrieve from AWS Secrets ManagerDOCKER_BUILDKIT: Enable BuildKit for faster Docker builds
Retrieves a secret from AWS Secrets Manager.
Response:
- Success:
Secret value: <secret> - Error: Appropriate HTTP status code with error message
The development environment is configured with:
- Go 1.22
- AWS CLI
- Docker-in-Docker
- VS Code extensions for Go development
The project uses Task for automation:
task devpod:up: Start DevPod workspacetask dev: Start development servertask test: Run teststask docker:build: Build Docker imagetask docker:run: Run container
- AWS credentials are mounted from host machine
- Non-root user in container
- Minimal base image (scratch)
- SSL certificates included for AWS SDK