Using the S3 backend in AWS
In the previous recipe, we learned how to authenticate the aws Terraform provider, then how to use Terraform to provision resources on AWS.
In the Protecting the state file in the Azure remote backend recipe of Chapter 8, Provisioning Azure Infrastructure with Terraform, we learned the importance of storing Terraform state in a backend and how to protect the Terraform state file in Azure Storage.
Now, using the same concept, in this recipe, we will learn how to store the state file in AWS using S3’s bucket feature.
Let’s get started!
Getting ready
To complete this recipe, there are no specific requirements.
We will create an S3 bucket manually in the AWS console and we will configure Terraform to use this S3 bucket as a Terraform state backend.
To create this S3 bucket, we will perform the following steps:
- Sign in to the AWS console.
- Create an S3 bucket by selecting S3 in the Services menu (use...