Intermediate2h estimated

Enforce EC2 IMDSv2 with Terraform Cloud OPA Policies

Build a defense-in-depth control for Amazon EC2 Instance Metadata Service v2 (IMDSv2). This lab uses Terraform Cloud OPA policies to block noncompliant Terraform plans and an AWS Service Control Policy (SCP) to prevent EC2 launches that do not require IMDSv2 at the API layer.

Topics Covered

Terraform CloudOpen Policy AgentRegoAmazon EC2IMDSv2GitHub Actions

Prerequisites

  • Terraform Cloud Account
  • GitHub Account
  • Basic knowledge of Terraform
  • Basic familiarity with Open Policy Agent and Rego

Ready to get started?

Sign up or log in to access the full walkthrough with step-by-step instructions and progress tracking.