Ravi Sir's Cards › AWS
Remote state (S3 + lock)
This revision card explains Remote state (S3 + lock). It starts from the need that two people apply at once with local state can corrupt or double-create resources. It describes store state in S3 and lock with DynamoDB (or S3 native lock where enabled) so only one apply runs. The how-to section notes configure backend s3 with bucket, key, region, and dynamodb_table; run init -migrate-state. An example on the card is second apply waits or errors on lock instead of racing the first.
Read card text
What this card says
Why do we need it?
Two people apply at once with local state can corrupt or double-create resources.
What is it?
Store state in S3 and lock with DynamoDB (or S3 native lock where enabled) so only one apply runs.
backend "s3"
How to do it
Configure backend s3 with bucket, key, region, and dynamodb_table; run init -migrate-state.
Example
Second apply waits or errors on lock instead of racing the first.