|
| 1 | +## Using cloud authentication with Redis {% new_in 3.13 %} |
| 2 | + |
| 3 | +Starting in {{site.base_gateway}} 3.13, you can authenticate with a cloud Redis provider for your Redis strategy. This allows you to seamlessly rotate credentials without relying on static passwords. |
| 4 | + |
| 5 | +The following providers are supported: |
| 6 | +* AWS ElastiCache |
| 7 | +* Azure Managed Redis |
| 8 | +* Google Cloud Memorystore (with or without Valkey) |
| 9 | + |
| 10 | +Each provider also supports an instance and cluster configuration. |
| 11 | + |
| 12 | +{:.warning} |
| 13 | +> **Important:** {{site.base_gateway}} open source plugins do not support any Redis cloud provider cluster configurations. |
| 14 | +
|
| 15 | +To configure cloud authentication with Redis, add the following parameters to your plugin configuration: |
| 16 | + |
| 17 | +{% navtabs "providers" %} |
| 18 | +{% navtab "AWS instance" %} |
| 19 | + |
| 20 | +You need: |
| 21 | +* A running Redis instance on an [AWS ElastiCache instance](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html) for Valkey 7.2 or later or ElastiCache for Redis OSS version 7.0 or later |
| 22 | +* The [ElastiCache user needs to set "Authentication mode" to "IAM"](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html#auth-iam-setup) |
| 23 | +* The following policy assigned to the IAM user/IAM role that is used to connect to the ElastiCache: |
| 24 | + ```json |
| 25 | + { |
| 26 | + "Version": "2012-10-17", |
| 27 | + "Statement": [ |
| 28 | + { |
| 29 | + "Effect": "Allow", |
| 30 | + "Action": [ |
| 31 | + "elasticache:Connect" |
| 32 | + ], |
| 33 | + "Resource": [ |
| 34 | + "arn:aws:elasticache:ARN_OF_THE_ELASTICACHE", |
| 35 | + "arn:aws:elasticache:ARN_OF_THE_ELASTICACHE_USER" |
| 36 | + ] |
| 37 | + } |
| 38 | + ] |
| 39 | + } |
| 40 | + ``` |
| 41 | + |
| 42 | +```yaml |
| 43 | +config: |
| 44 | + storage: redis |
| 45 | + storage_config: |
| 46 | + redis: |
| 47 | + host: $INSTANCE_ADDRESS |
| 48 | + username: $INSTANCE_USERNAME |
| 49 | + port: 6379 |
| 50 | + cloud_authentication: |
| 51 | + auth_provider: aws |
| 52 | + aws_cache_name: $AWS_CACHE_NAME |
| 53 | + aws_is_serverless: false |
| 54 | + aws_region: $AWS_REGION |
| 55 | + aws_access_key_id: $AWS_ACCESS_KEY_ID |
| 56 | + aws_secret_access_key: $AWS_ACCESS_SECRET_KEY |
| 57 | +``` |
| 58 | +
|
| 59 | +Replace the following with your actual values: |
| 60 | +* `$INSTANCE_ADDRESS`: The ElastiCache instance address. |
| 61 | +* `$INSTANCE_USERNAME`: The ElastiCache username with [IAM Auth mode configured](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html#auth-iam-setup). |
| 62 | +* `$AWS_CACHE_NAME`: Name of your AWS ElastiCache instance. |
| 63 | +* `$AWS_REGION`: Your AWS ElastiCache instance region. |
| 64 | +* `$AWS_ACCESS_KEY_ID`: (Optional) Your AWS access key ID. |
| 65 | +* `$AWS_ACCESS_SECRET_KEY`: (Optional) Your AWS secret access key. |
| 66 | +{% endnavtab %} |
| 67 | +{% navtab "AWS cluster" %} |
| 68 | + |
| 69 | +You need: |
| 70 | +* A running Redis instance on an [AWS ElastiCache cluster](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html) for Valkey 7.2 or later or ElastiCache for Redis OSS version 7.0 or later |
| 71 | +* The [ElastiCache user needs to set "Authentication mode" to "IAM"](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html#auth-iam-setup) |
| 72 | +* The following policy assigned to the IAM user/IAM role that is used to connect to the ElastiCache: |
| 73 | + ```json |
| 74 | + { |
| 75 | + "Version": "2012-10-17", |
| 76 | + "Statement": [ |
| 77 | + { |
| 78 | + "Effect": "Allow", |
| 79 | + "Action": [ |
| 80 | + "elasticache:Connect" |
| 81 | + ], |
| 82 | + "Resource": [ |
| 83 | + "arn:aws:elasticache:ARN_OF_THE_ELASTICACHE", |
| 84 | + "arn:aws:elasticache:ARN_OF_THE_ELASTICACHE_USER" |
| 85 | + ] |
| 86 | + } |
| 87 | + ] |
| 88 | + } |
| 89 | + ``` |
| 90 | + |
| 91 | +```yaml |
| 92 | +config: |
| 93 | + storage: redis |
| 94 | + storage_config: |
| 95 | + redis: |
| 96 | + cluster_nodes: |
| 97 | + - ip: $CLUSTER_ADDRESS |
| 98 | + port: 6379 |
| 99 | + username: $CLUSTER_USERNAME |
| 100 | + port: 6379 |
| 101 | + cloud_authentication: |
| 102 | + auth_provider: aws |
| 103 | + aws_cache_name: $AWS_CACHE_NAME |
| 104 | + aws_is_serverless: false |
| 105 | + aws_region: $AWS_REGION |
| 106 | + aws_access_key_id: $AWS_ACCESS_KEY_ID |
| 107 | + aws_secret_access_key: $AWS_ACCESS_SECRET_KEY |
| 108 | +``` |
| 109 | + |
| 110 | +Replace the following with your actual values: |
| 111 | +* `$CLUSTER_ADDRESS`: The ElastiCache cluster address. |
| 112 | +* `$CLUSTER_USERNAME`: The ElastiCache username with [IAM Auth mode configured](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html#auth-iam-setup). |
| 113 | +* `$AWS_CACHE_NAME`: Name of your AWS ElastiCache cluster. |
| 114 | +* `$AWS_REGION`: Your AWS ElastiCache cluster region. |
| 115 | +* `$AWS_ACCESS_KEY_ID`: (Optional) Your AWS access key ID. |
| 116 | +* `$AWS_ACCESS_SECRET_KEY`: (Optional) Your AWS secret access key. |
| 117 | +{% endnavtab %} |
| 118 | +{% navtab "Azure instance" %} |
| 119 | + |
| 120 | +You need: |
| 121 | +* A running Redis instance on an [Azure Managed Redis instance](https://learn.microsoft.com/en-us/azure/redis/entra-for-authentication) with Entra authentication configured |
| 122 | +* Add the [user/service principal/identity to the "Microsoft Entra Authentication Redis user" list](https://learn.microsoft.com/en-us/azure/redis/entra-for-authentication#add-users-or-system-principal-to-your-cache) for the Azure Managed Redis instance |
| 123 | + |
| 124 | +```yaml |
| 125 | +config: |
| 126 | + storage: redis |
| 127 | + storage_config: |
| 128 | + redis: |
| 129 | + host: $INSTANCE_ADDRESS |
| 130 | + username: $INSTANCE_USERNAME |
| 131 | + port: 6379 |
| 132 | + cloud_authentication: |
| 133 | + auth_provider: azure |
| 134 | + azure_client_id: $AZURE_CLIENT_ID |
| 135 | + azure_client_secret: $AZURE_CLIENT_SECRET |
| 136 | + azure_tenant_id: $AZURE_TENANT_ID |
| 137 | +``` |
| 138 | +Replace the following with your actual values: |
| 139 | +* `$INSTANCE_ADDRESS`: The Azure Managed Redis instance address. |
| 140 | +* `$INSTANCE_USERNAME`: The object (principal) ID of the Principal/Identity with essential access. |
| 141 | +* `$AZURE_CLIENT_ID`: The client ID of the Principal/Identity. |
| 142 | +* `$AZURE_CLIENT_SECRET`: (Optional) The client secret of the Principal/Identity. |
| 143 | +* `$AZURE_TENANT_ID`: (Optional) The tenant ID of the Principal/Identity. |
| 144 | + |
| 145 | +{% endnavtab %} |
| 146 | +{% navtab "Azure cluster" %} |
| 147 | + |
| 148 | +You need: |
| 149 | +* A running Redis instance on an [Azure Managed Redis cluster](https://learn.microsoft.com/en-us/azure/redis/entra-for-authentication) with Entra authentication configured |
| 150 | +* Add the [user/service principal/identity to the "Microsoft Entra Authentication Redis user" list](https://learn.microsoft.com/en-us/azure/redis/entra-for-authentication#add-users-or-system-principal-to-your-cache) for the Azure Managed Redis instance |
| 151 | + |
| 152 | +```yaml |
| 153 | +config: |
| 154 | + storage: redis |
| 155 | + storage_config: |
| 156 | + redis: |
| 157 | + cluster_nodes: |
| 158 | + - ip: $CLUSTER_ADDRESS |
| 159 | + port: 6379 |
| 160 | + username: $CLUSTER_USERNAME |
| 161 | + port: 6379 |
| 162 | + cloud_authentication: |
| 163 | + auth_provider: azure |
| 164 | + azure_client_id: $AZURE_CLIENT_ID |
| 165 | + azure_client_secret: $AZURE_CLIENT_SECRET |
| 166 | + azure_tenant_id: $AZURE_TENANT_ID |
| 167 | +``` |
| 168 | +Replace the following with your actual values: |
| 169 | +* `$CLUSTER_ADDRESS`: The Azure Managed Redis cluster address. |
| 170 | +* `$CLUSTER_USERNAME`: The object (principal) ID of the Principal/Identity with essential access. |
| 171 | +* `$AZURE_CLIENT_ID`: The client ID of the Principal/Identity. |
| 172 | +* `$AZURE_CLIENT_SECRET`: (Optional) The client secret of the Principal/Identity. |
| 173 | +* `$AZURE_TENANT_ID`: (Optional) The tenant ID of the Principal/Identity. |
| 174 | + |
| 175 | +{% endnavtab %} |
| 176 | +{% navtab "GCP instance" %} |
| 177 | + |
| 178 | +You need: |
| 179 | +* A running Redis instance on an [Google Cloud Memorystore instance](https://cloud.google.com/memorystore/docs/cluster/about-iam-auth) |
| 180 | +* Assign the principal to the corresponding role: |
| 181 | + * [Cloud Memorystore Redis DB Connection User(`roles/redis.dbConnectionUser`)](https://docs.cloud.google.com/memorystore/docs/cluster/about-iam-auth) for Memorystore for Redis Cluster |
| 182 | + * [Memorystore DB Connector User (`roles/memorystore.dbConnectionUser`)](https://docs.cloud.google.com/memorystore/docs/valkey/about-iam-auth) for Memorystore for Valkey |
| 183 | + |
| 184 | +```yaml |
| 185 | +config: |
| 186 | + storage: redis |
| 187 | + storage_config: |
| 188 | + redis: |
| 189 | + host: $INSTANCE_ADDRESS |
| 190 | + port: 6379 |
| 191 | + cloud_authentication: |
| 192 | + auth_provider: gcp |
| 193 | + gcp_service_account_json: $GCP_SERVICE_ACCOUNT |
| 194 | +``` |
| 195 | +Replace the following with your actual values: |
| 196 | +* `$INSTANCE_ADDRESS`: The Memorystore instance address. |
| 197 | +* `$GCP_SERVICE_ACCOUNT`: (Optional) The GCP service account JSON. |
| 198 | +{% endnavtab %} |
| 199 | +{% navtab "GCP cluster" %} |
| 200 | + |
| 201 | +You need: |
| 202 | +* A running Redis instance on an [Google Cloud Memorystore cluster](https://cloud.google.com/memorystore/docs/cluster/about-iam-auth) |
| 203 | +* Assign the principal to the corresponding role: |
| 204 | + * [Cloud Memorystore Redis DB Connection User(`roles/redis.dbConnectionUser`)](https://docs.cloud.google.com/memorystore/docs/cluster/about-iam-auth) for Memorystore for Redis Cluster |
| 205 | + * [Memorystore DB Connector User (`roles/memorystore.dbConnectionUser`)](https://docs.cloud.google.com/memorystore/docs/valkey/about-iam-auth) for Memorystore for Valkey |
| 206 | + |
| 207 | +```yaml |
| 208 | +config: |
| 209 | + storage: redis |
| 210 | + storage_config: |
| 211 | + redis: |
| 212 | + cluster_nodes: |
| 213 | + - ip: $CLUSTER_ADDRESS |
| 214 | + port: 6379 |
| 215 | + port: 6379 |
| 216 | + cloud_authentication: |
| 217 | + auth_provider: gcp |
| 218 | + gcp_service_account_json: $GCP_SERVICE_ACCOUNT |
| 219 | +``` |
| 220 | +Replace the following with your actual values: |
| 221 | +* `$CLUSTER_ADDRESS`: The Memorystore cluster address. |
| 222 | +* `$GCP_SERVICE_ACCOUNT`: The GCP service account JSON. |
| 223 | +{% endnavtab %} |
| 224 | +{% endnavtabs %} |
0 commit comments