Where is my db-instance ?!

前言:

有一天, 我的同事詢問我:『為什麼在部門內的帳號 RDS console 出現 2 個 DB Instances 以及 1 個 DB Clustersrds dashboard 但是點進去Databaes Console 卻什麼也沒有?!』 rds instance console

於是把尋找 『不存在的 db instance 之旅』過程記錄了下來。

  1. 首先我在該 region (us-east-1),打開了 AWS CloudShell (當前支持 region)。

  2. 接著我透過aws rds describe-db-clusters 取得所有的 DB Clusters,以下是我的結果。

$ aws rds describe-db-clusters 
{
    "DBClusters": [
        {
            "AllocatedStorage": 1,
            "AvailabilityZones": [
                "us-east-1c",
                "us-east-1d",
                "us-east-1b"
            ],
            "BackupRetentionPeriod": 1,
            "DBClusterIdentifier": "docdb-test",
            "DBClusterParameterGroup": "default.docdb4.0",
            "DBSubnetGroup": "default",
            "Status": "available",
            "EarliestRestorableTime": ".....",
            "Endpoint": "docdb-test.cluster-xxxxxxxxxxx.us-east-1.docdb.amazonaws.com",
            "ReaderEndpoint": "docdb-test.cluster-ro-xxxxxxxxxxx.us-east-1.docdb.amazonaws.com", # endpoint 的結尾是 docdb 是 27017 <--------
            "MultiAZ": true,
            "Engine": "docdb",
            "EngineVersion": "4.0.0",
            "LatestRestorableTime": "2021-12-16T02:56:01.379000+00:00",
            "Port": 27017,                        # Port 是 27017 <--------
            "MasterUsername": "admin",
            "PreferredBackupWindow": "00:00-00:30",
            "PreferredMaintenanceWindow": "sat:07:57-sat:08:27",
            "ReadReplicaIdentifiers": [],
            "DBClusterMembers": [
                {
                    "DBInstanceIdentifier": "docdb-test",
                    "IsClusterWriter": false,
                    "DBClusterParameterGroupStatus": "in-sync",
                    "PromotionTier": 1
                },
                {
                    "DBInstanceIdentifier": "docdb-test",
                    "IsClusterWriter": true,
                    "DBClusterParameterGroupStatus": "in-sync",
                    "PromotionTier": 1
                }
            ],
            "VpcSecurityGroups": [
                {
                    "VpcSecurityGroupId": "sg-xxxxxxxxx",
                    "Status": "active"
                }
            ],
            "HostedZoneId": "ZNXXXXXXXXX"

在看完全部內容後,發現了兩個疑點:

  • ReaderEndpoint 的結尾是 docdb.amazonaws.com
  • Port27017

這讓我想到 Mongo DB,然後突然想到,AWS 有提供 Amazon DocumentDB 的這項服務,立馬跑到 Amazon DocumentDB Console 一探究盡。

果真這邊有一個 DocumentDB Cluster 內有 兩個 DB Insatnces,結束了這場鬧劇。

2021年12月16日 Neil Kuan


NeilKuan

RDSDOCAWS

160 Words

2021-12-16 00:00 +0000