Terraform + Ansible to provision and configure an AWS EC2 instance that mirrors
the setup-sandbox workshop environment (Vault CLI, JDK 23, Maven 3, Helm, kubectl,
k3s, PostgreSQL, and the workshop-vault-agent-devs repo running under Docker Compose).
Access is provided via Doormat Session using the AWS SSM Agent — no bastion or open inbound ports required.
| Tool | Purpose |
|---|---|
| Terraform >= 1.15 | Provision EC2 infrastructure |
| Ansible >= 2.14 | Configure the EC2 instance |
cd terraform
terraform init
terraform applyThe default region is us-east-2.
The configuration creates the ansible/inventory.ini and sandbox.pem files dynamically.
terraform destroySet the AWS region to match your deployment:
export AWS_DEFAULT_REGION=us-east-2cd ansible
ansible-playbook -i inventory.ini playbook.ymlThe playbook will:
- Verify the SSM Agent is running
- Install base packages (
jq,postgresql-client,unzip,docker.io, etc.) - Install
kubectl(latest stable) - Install Helm
3.17.3 - Install Vault CLI
1.21.4 - Install Oracle JDK 23.0.2
- Install Apache Maven 3.9.16 (added to system-wide
PATH) - Clone
workshop-vault-agent-devsand start the Docker Compose services
Version pins live in ansible/vars.yml.
- Ubuntu 24.04 EC2 images from Canonical ship
snapdand auto-installamazon-ssm-agentvia cloud-init on first boot. - The IAM instance profile created by Terraform attaches two policies:
AmazonSSMManagedInstanceCore— allows SSM Agent to register and communicateSecurityComputeAccess— required for Doormat Session access
- The instance has no inbound security group rules. All Doormat connectivity is outbound on port 443.
- Access is unrestricted to all users with
sessiongroup access to the AWS account. To restrict to specific Google groups, tag the instance withhc-doormat-restrict.