Wiki › Project

Terraform EC2 demo

Article
From Chaipat's knowledge graph

Terraform EC2 demo solves an infrastructure-as-code challenge from roadmap.sh, using AWS EC2 in place of DigitalOcean. A Terraform configuration creates one Ubuntu EC2 instance with a public IP address in the account's default network, and allows SSH access with the user's own existing key.

Details

  • The configuration is split into providers, variables, outputs and a reusable module, as Terraform projects usually are.
  • Credentials come from an AWS profile or environment variables, never from files in the repository. An example variables file shows what to fill in.
  • The provider lock file is committed, so every run uses the same provider versions.

The next challenges followed on from this one: deploying a Node.js service with Terraform and Ansible, then a containerised service.

See also