Terraform Remote State Lab Complete (Part 5)
Completed another step in my Terraform and AWS journey by migrating my Terraform state from a local file to a remote backend using Amazon S3 and DynamoDB. This lab gave me hands-on experience with state management, encryption, versioning, and state locking—showing how infrastructure teams safely collaborate on cloud resources without risking state corruption.
Key objectives completed:
✅ Created an Amazon S3 bucket to store Terraform state files remotely
✅ Enabled S3 Versioning to protect against accidental state file deletion or corruption
✅ Enabled Server-Side Encryption (AES256) to secure Terraform state data
✅ Created a DynamoDB table for Terraform state locking
✅ Migrated local Terraform state to the remote backend
✅ Verified Terraform state file creation in S3
✅ Successfully updated infrastructure while using the remote backend
✅ Demonstrated Terraform state locking with DynamoDB
The most important part of this lab was proving state locking works.
I intentionally opened two Terraform sessions:
• Session 1 acquired the Terraform state lock
• Session 2 attempted to run Terraform against the same state
• DynamoDB detected the active lock and blocked the second operation
This prevents multiple engineers from modifying the same infrastructure simultaneously and protects the Terraform state file from corruption.
Lab Progress:
Part 1 ✅ Terraform VPC Deployment
Part 2 ✅ Public Subnet & Bastion Host
Part 3 ✅ Private Subnet & NAT Gateway
Part 4 ✅ SSH from Bastion Host to Private EC2
Part 5 ✅ Remote Terraform State (S3 + DynamoDB Locking)
Next up:
Part 6 – Jenkins CI/CD Pipeline for Terraform Deployments
Architecture:
Terraform
↓
Amazon S3 Remote State
↓
DynamoDB State Locking
This project continues building my cloud, infrastructure-as-code, and DevOps skills while creating a portfolio that demonstrates real-world AWS and Terraform concepts.
https://github.com/jrdnhns/terraform-...
#AWS #Terraform #CloudComputing #DevOps #InfrastructureAsCode #IaC #AmazonWebServices #S3 #DynamoDB #CloudEngineer #DevOpsEngineer #TechPortfolio #GitHub #LearningInPublic #Cybersecurity #Jenkins #Automation