AWS DAX Subnet Group
This page shows how to write Terraform and CloudFormation for DAX Subnet Group and write them securely.
aws_dax_subnet_group (Terraform)
The Subnet Group in DAX can be configured in Terraform with the resource name aws_dax_subnet_group
. The following sections describe 3 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_dax_subnet_group" "this" {
description = var.description
name = var.name
subnet_ids = var.subnet_ids
}
resource "aws_dax_subnet_group" "example" {
name = var.subnet_group_name
description = ""
subnet_ids = var.subnet_ids
}
resource "aws_dax_subnet_group" "subnet_group" {
name = var.name
subnet_ids = var.subnet_ids
}
# Create DAX Subnet Group
resource "aws_dax_parameter_group" "parameter_group" {
Parameters
-
description
optional - string -
id
optional computed - string -
name
required - string -
subnet_ids
required - set of string -
vpc_id
optional computed - string
Explanation in Terraform Registry
Provides a DAX Subnet Group resource.
Tips: Best Practices for The Other AWS DAX Resources
In addition to the aws_dax_cluster, AWS DAX has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_dax_cluster
Ensure to enable at rest encryption of DynamoDB Accelerator
It's better to enable at rest encryption of DynamoDB Accelerator to protect your data from unauthorized access to the underlying storage.
AWS::DAX::SubnetGroup (CloudFormation)
The SubnetGroup in DAX can be configured in CloudFormation with the resource name AWS::DAX::SubnetGroup
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::DAX::SubnetGroup
Properties:
SubnetGroupName:
Fn::Join:
- "-"
- - CsdDaxSubnetGroup
Type: AWS::DAX::SubnetGroup
Properties:
SubnetIds:
- Ref: daxSubnet1
- Ref: daxSubnet2
DaxVpcSecurityGroup:
Type: AWS::DAX::SubnetGroup
Properties:
SubnetGroupName: DaxSubnetGroup
Description: Subnet Group For DAX Cluster
SubnetIds:
- Fn::ImportValue: "CsdNetwork-DaxSubnet1Id"
Type: AWS::DAX::SubnetGroup
Properties:
Description: Subnet Group for CCUConnect
SubnetGroupName: ${self:custom.prefix}-group
SubnetIds:
- !Ref PrivateSubnet1
Type: AWS::DAX::SubnetGroup
Properties:
SubnetGroupName: my-dax-subnet-group
Description: !Ref AWS::StackName
SubnetIds:
- Fn::ImportValue: !Sub ${NetworkStackName}-DatastoreSubnet1Id
"AWS::DAX::SubnetGroup": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html",
"Properties": {
"Description": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description",
"AWS::DAX::SubnetGroup": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html",
"Properties": {
"Description": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description",
"AWS::DAX::SubnetGroup": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html",
"Properties": {
"Description": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description",
"AWS::DAX::SubnetGroup": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html",
"Properties": {
"Description": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description",
"AWS::DAX::SubnetGroup": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html",
"Properties": {
"Description": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description",
Parameters
-
Description
optional - String -
SubnetGroupName
optional - String -
SubnetIds
required - List
Explanation in CloudFormation Registry
Creates a new subnet group.
Frequently asked questions
What is AWS DAX Subnet Group?
AWS DAX Subnet Group is a resource for DAX of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS DAX Subnet Group?
For Terraform, the niveklabs/aws, JamesWoolfenden/terraform-aws-dax and devops-made-easy/terraform-aws-dax source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the mmanoj880/BaseInfra, yai333/AppsyncDax and mmanoj880/BaseInfraWM source code examples are useful. See the CloudFormation Example section for further details.