Create IAM resources using Terraform
| Redis Cloud |
|---|
You can use HashiCorp Terraform to create identity and access management (IAM) resources to support AWS cloud account access to Redis Cloud subscriptions.
We use the provided credentials to configure your AWS environment and provision required resources.
You must not change the configurations of provisioned resources or stop or terminate provisioned instances. If you do, your databases will be inaccessible and Redis will not be able to ensure database stability. See Avoid service disruption for more details.
The following example uses the terraform-aws-Redislabs-Cloud-Account-IAM-Resources module, located in Amazon S3:
-
Copy the following code into a file called
main.tf.Replace the following values in the
main.tffile:<profile>: The AWS CLI profile to use.<region>: The AWS region to use.<pgp_key>: The PGP key to use. For details, see the Terraform docs.
-
Initialize Terraform with the module:
Note: Terraform requires AWS credentials be supplied, but the source of the module is a public S3 bucket, so any valid credentials should work.
AWS_ACCESS_KEY_ID=<access_key_id> AWS_SECRET_KEY=<secret_key> terraform initReplace
<access_key_id>and<secret_key>with valid AWS keys. -
Build the resources and display the outputs:
terraform applyYou need the following information to create a Cloud Account in the Redis Cloud console:
- Access Key ID: The
accessKeyIdoutput. - Secret Access Key: Run the following command to extract the secret key from the
accessSecretKeyoutput:echo $(terraform output -raw accessSecretKey) - IAM Role Name: The
IAMRoleNameoutput.
- Access Key ID: The