How to use the @aws-cdk/aws-elasticache.CfnSubnetGroup function in @aws-cdk/aws-elasticache

To help you get started, we’ve selected a few @aws-cdk/aws-elasticache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / aws-cdk-changelogs-demo / custom-constructs / redis.js View on Github external
constructor(scope, id, props) {
    super(scope, id);

    const targetVpc = props.vpc;

    // Define a group for telling Elasticache which subnets to put cache nodes in.
    const subnetGroup = new elasticache.CfnSubnetGroup(this, `${id}-subnet-group`, {
      description: `List of subnets used for redis cache ${id}`,
      subnetIds: targetVpc.privateSubnets.map(function(subnet) {
        return subnet.subnetId;
      })
    });

    // The security group that defines network level access to the cluster
    this.securityGroup = new ec2.SecurityGroup(this, `${id}-security-group`, { vpc: targetVpc });

    this.connections = new ec2.Connections({
      securityGroups: [this.securityGroup],
      defaultPortRange: new ec2.TcpPort(6379)
    });

    // The cluster resource itself.
    this.cluster = new elasticache.CfnCacheCluster(this, `${id}-cluster`, {

@aws-cdk/aws-elasticache

The CDK Construct Library for AWS::ElastiCache

Apache-2.0
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis