Hands-On LabIntermediate

Configure Terraform Remote State with S3 and DynamoDB Backend

Configure an S3 backend with DynamoDB locking for Terraform remote state, migrate local state, and verify encryption and locking behavior.

50 minEstimated time
3Guided steps
AutoVerification
IsolatedSandbox
Configure Terraform Remote State with S3 and DynamoDB Backend

Lab overview

Terraform state is the mechanism that maps your declared HCL resources to real infrastructure objects in the cloud. By default, Terraform stores this state in a local file called terraform.tfstate, which works fine for solo experimentation but breaks down quickly in team environments: concurrent applies can corrupt the file, secrets stored in state sit unencrypted on disk, and there is no built-in mechanism to prevent two engineers from running terraform apply at the same time. Remote state backends solve all three problems by storing state in a shared, durable location with locking and encryption built in.

On AWS, the standard remote backend uses an S3 bucket for state storage and a DynamoDB table for state locking. S3 provides versioning, server-side encryption, and cross-region replication options, while DynamoDB implements a lock table that prevents concurrent modifications from corrupting state. In this lab, the S3 state bucket and DynamoDB lock table are pre-provisioned for you; you will deploy initial infrastructure using local state, configure a Terraform backend block pointing to these resources, migrate your existing local state to the remote backend, and verify that encryption and locking are working correctly.

Objectives

By completing this intermediate lab, you will be able to:

  • Deploy AWS infrastructure using Terraform with local state storage
  • Understand how an S3 bucket (with versioning and server-side encryption) and a DynamoDB lock table form a Terraform remote backend
  • Configure a Terraform S3 backend block with bucket, key, region, and lock table settings
  • Migrate existing local state to the S3 remote backend using terraform init -migrate-state
  • Verify state locking behavior and confirm encryption on the stored state file

Who is this lab for?

  • Cloud Engineers managing shared Terraform projects on AWS who need a reliable remote state solution
  • DevOps Practitioners looking to implement state locking and encryption best practices
  • Infrastructure Engineers transitioning from local Terraform workflows to team-ready remote backends

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed — not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

Related reading

PremiumIncluded in Premium
Duration
50 min
Steps
3

Environment

Live Cloud EnvironmentBrowser Code IDE

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Logging into the AWS CLI

  2. 02

    Deploying Initial Infrastructure with Local State

    1 automated check

  3. 03

    Migrating State and Verifying Locking and Encryption

    2 automated checks

Skills validated

TerraformAmazon S3Amazon DynamoDBTerraform State

Not the lab you were looking for?

Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog