LoginSignup
1
0

More than 5 years have passed since last update.

Auroraのカスタムエンドポイントを検証しました。

Posted at

はじめに

業務で読み込み用カスタムエンドポイントを作成して動作を検証する際のメモですがどなたかの参考になれば幸いです

動作環境

  • Cluster名: test-cluster
  • write: test-a
  • read: test-b

エンドポイントの作成

$ aws rds create-db-cluster-endpoint --db-cluster-identifier test-cluster --db-cluster-endpoint-identifier test --endpoint-type reader
{
    "DBClusterEndpointIdentifier": "test",
    "DBClusterIdentifier": "test-cluster",
    "DBClusterEndpointResourceIdentifier": "cluster-endpoint-xxxxxxx",
    "Endpoint": "test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com",
    "Status": "creating",
    "EndpointType": "CUSTOM",
    "CustomEndpointType": "READER",
    "StaticMembers": [],
    "ExcludedMembers": [],
    "DBClusterEndpointArn": "arn:aws:rds:ap-northeast-1:xxx:cluster-endpoint:test"
}

エンドポイントの確認

$ aws rds describe-db-cluster-endpoints --db-cluster-identifier test-cluster --db-cluster-endpoint-identifier test
{
    "DBClusterEndpoints": [
        {
            "DBClusterEndpointIdentifier": "test",
            "DBClusterIdentifier": "test-cluster",
            "DBClusterEndpointResourceIdentifier": "cluster-endpoint-xxxxxxx",
            "Endpoint": "test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com",
            "Status": "available",
            "EndpointType": "CUSTOM",
            "CustomEndpointType": "READER",
            "StaticMembers": [],
            "ExcludedMembers": [],
            "DBClusterEndpointArn": "arn:aws:rds:ap-northeast-1:xxx:cluster-endpoint:test"
        }
    ]
}

出来上がったカスタムエンドポイントでDNS確認

$ dig test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com +short
test-b.xxx.ap-northeast-1.rds.amazonaws.com.
172.31.18.184

フェイルオーバーをしてみる

ここでtest-clusterをフェイルオーバーします。
test-a ⇔ test-b が入れ替わったのを確認

ファイルオーバー後に確認

$ dig test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com +short
test-a.xxx.ap-northeast-1.rds.amazonaws.com.
172.31.9.243

読み込み用インスタンスの追加

ここでtest-cというインスタンスを追加します

digで確認

test-cという読み込みインスタンスを追加するとIP引けるようになってしまった

$ dig test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com +short
test-c.xxx.ap-northeast-1.rds.amazonaws.com.
172.31.18.222
$ dig test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com +short
test-a.xxx.ap-northeast-1.rds.amazonaws.com.
172.31.9.243

test-cを除外する

$ aws rds modify-db-cluster-endpoint --db-cluster-endpoint-identifier test --excluded-members test-c
$ aws rds describe-db-cluster-endpoints --db-cluster-identifier test-cluster --db-cluster-endpoint-identifier test
{
    "DBClusterEndpoints": [
        {
            "DBClusterEndpointIdentifier": "test",
            "DBClusterIdentifier": "test-cluster",
            "DBClusterEndpointResourceIdentifier": "cluster-endpoint-xxx",
            "Endpoint": "test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com",
            "Status": "available",
            "EndpointType": "CUSTOM",
            "CustomEndpointType": "READER",
            "StaticMembers": [],
            "ExcludedMembers": [
                "test-c"
            ],
            "DBClusterEndpointArn": "arn:aws:rds:ap-northeast-1:xxx:cluster-endpoint:test"
        }
    ]
}

digで確認

$ dig test.cluster-custom-xxx.ap-northeast-1.rds.amazonaws.com +short
test-a.xxx.ap-northeast-1.rds.amazonaws.com.
172.31.9.243
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