1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

aws cdk v2 でクラスターモードオフなelasticacheを作成

Last updated at Posted at 2022-10-04

環境

cdk --version
2.44.0 (build bf32cb1)

結論

aws cdk でelasticacheを作成するときに

  • クラスターモード オフ
  • マルチAZ オン

を満たす一例は下記です。

cdk.ts
    const subnetGroup = new CfnSubnetGroup(this, 'redis-cluster-subnet-group', {
      cacheSubnetGroupName: 'redis-private-subnet',
      subnetIds: vpc.privateSubnets.map(({ subnetId }) => subnetId),
      description: 'private subnet',
    });

    const redis = new CfnReplicationGroup(this, 'redis-cluster', {
      engine: 'Redis',
      cacheNodeType: 'cache.t4g.micro',
      engineVersion: '6.2',
      replicasPerNodeGroup: 1,
      numNodeGroups: 1,
      replicationGroupDescription: 'cdk setup',
      cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
      multiAzEnabled: true,
    });

    redis.addDependsOn(subnetGroup);

numNodeGroupsが2以上になると、クラスターモードがオンになり、プライマリエンドポイントリーダーエンドポイントが発行されませんでした。

上記のデプロイ後、管理画面でみるとこうなります↓
すでに削除して、リソースはないのですが、念の為、ARNとか黒塗りにしてます。

スクリーンショット 2022-10-04 18.57.26.png

elasticacheのcdkってちょっちわかりにくいですよね。。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?