本文件 AWS CLI 僅適用於 的第 1 版。如需與 第 2 版相關的文件 AWS CLI,請參閱 第 2 版使用者指南 。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 的 Amazon RDS範例 AWS CLI
下列程式碼範例示範如何搭配 AWS Command Line Interface Amazon 使用 來執行動作和實作常見案例RDS。
Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。
每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。
主題
動作
下列程式碼範例示範如何使用 add-option-to-option-group
。
- AWS CLI
-
將選項新增至選項群組
下列
add-option-to-option-group
範例會將選項新增至指定的選項群組。aws rds add-option-to-option-group \ --option-group-name
myoptiongroup
\ --optionsOptionName=OEM,Port=5500,DBSecurityGroupMemberships=default
\ --apply-immediately輸出:
{ "OptionGroup": { "OptionGroupName": "myoptiongroup", "OptionGroupDescription": "Test Option Group", "EngineName": "oracle-ee", "MajorEngineVersion": "12.1", "Options": [ { "OptionName": "Timezone", "OptionDescription": "Change time zone", "Persistent": true, "Permanent": false, "OptionSettings": [ { "Name": "TIME_ZONE", "Value": "Australia/Sydney", "DefaultValue": "UTC", "Description": "Specifies the timezone the user wants to change the system time to", "ApplyType": "DYNAMIC", "DataType": "STRING", "AllowedValues": "Africa/Cairo,Africa/Casablanca,Africa/Harare,Africa/Lagos,Africa/Luanda,Africa/Monrovia,Africa/Nairobi,Africa/Tripoli,Africa/Windhoek,America/Araguaina,America/Argentina/Buenos_Aires,America/Asuncion,America/Bogota,America/Caracas,America/Chicago,America/Chihuahua,America/Cuiaba,America/Denver,America/Detroit,America/Fortaleza,America/Godthab,America/Guatemala,America/Halifax,America/Lima,America/Los_Angeles,America/Manaus,America/Matamoros,America/Mexico_City,America/Monterrey,America/Montevideo,America/New_York,America/Phoenix,America/Santiago,America/Sao_Paulo,America/Tijuana,America/Toronto,Asia/Amman,Asia/Ashgabat,Asia/Baghdad,Asia/Baku,Asia/Bangkok,Asia/Beirut,Asia/Calcutta,Asia/Damascus,Asia/Dhaka,Asia/Hong_Kong,Asia/Irkutsk,Asia/Jakarta,Asia/Jerusalem,Asia/Kabul,Asia/Karachi,Asia/Kathmandu,Asia/Kolkata,Asia/Krasnoyarsk,Asia/Magadan,Asia/Manila,Asia/Muscat,Asia/Novosibirsk,Asia/Rangoon,Asia/Riyadh,Asia/Seoul,Asia/Shanghai,Asia/Singapore,Asia/Taipei,Asia/Tehran,Asia/Tokyo,Asia/Ulaanbaatar,Asia/Vladivostok,Asia/Yakutsk,Asia/Yerevan,Atlantic/Azores,Atlantic/Cape_Verde,Australia/Adelaide,Australia/Brisbane,Australia/Darwin,Australia/Eucla,Australia/Hobart,Australia/Lord_Howe,Australia/Perth,Australia/Sydney,Brazil/DeNoronha,Brazil/East,Canada/Newfoundland,Canada/Saskatchewan,Etc/GMT-3,Europe/Amsterdam,Europe/Athens,Europe/Berlin,Europe/Dublin,Europe/Helsinki,Europe/Kaliningrad,Europe/London,Europe/Madrid,Europe/Moscow,Europe/Paris,Europe/Prague,Europe/Rome,Europe/Sarajevo,Pacific/Apia,Pacific/Auckland,Pacific/Chatham,Pacific/Fiji,Pacific/Guam,Pacific/Honolulu,Pacific/Kiritimati,Pacific/Marquesas,Pacific/Samoa,Pacific/Tongatapu,Pacific/Wake,US/Alaska,US/Central,US/East-Indiana,US/Eastern,US/Pacific,UTC", "IsModifiable": true, "IsCollection": false } ], "DBSecurityGroupMemberships": [], "VpcSecurityGroupMemberships": [] }, { "OptionName": "OEM", "OptionDescription": "Oracle 12c EM Express", "Persistent": false, "Permanent": false, "Port": 5500, "OptionSettings": [], "DBSecurityGroupMemberships": [ { "DBSecurityGroupName": "default", "Status": "authorized" } ], "VpcSecurityGroupMemberships": [] } ], "AllowsVpcAndNonVpcInstanceMemberships": false, "OptionGroupArn": "arn:aws:rds:us-east-1:123456789012:og:myoptiongroup" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的將選項新增至選項群組。
-
如需API詳細資訊,請參閱 命令參考 AddOptionToOptionGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 add-role-to-db-cluster
。
- AWS CLI
-
將 AWS Identity and Access Management (IAM) 角色與資料庫叢集建立關聯
下列
add-role-to-db-cluster
範例會將角色與資料庫叢集建立關聯。aws rds add-role-to-db-cluster \ --db-cluster-identifier
mydbcluster
\ --role-arnarn:aws:iam::123456789012:role/RDSLoadFromS3
此命令不會產生輸出。
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的將IAM角色與 Amazon Aurora MySQL 資料庫叢集建立關聯。
-
如需API詳細資訊,請參閱 命令參考 AddRoleToDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 add-role-to-db-instance
。
- AWS CLI
-
將 AWS Identity and Access Management (IAM) 角色與資料庫執行個體建立關聯
下列
add-role-to-db-instance
範例會將角色新增至名為 的 Oracle 資料庫執行個體test-instance
。aws rds add-role-to-db-instance \ --db-instance-identifier
test-instance
\ --feature-nameS3_INTEGRATION
\ --role-arnarn:aws:iam::111122223333:role/rds-s3-integration-role
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon 使用者指南 中的 Amazon RDS Oracle Integration 與 Amazon S3 的先決條件。 RDS
-
如需API詳細資訊,請參閱 命令參考 AddRoleToDbInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 add-source-identifier-to-subscription
。
- AWS CLI
-
將來源識別符新增至訂閱
下列
add-source-identifier
範例會將另一個來源識別符新增至現有的訂閱。aws rds add-source-identifier-to-subscription \ --subscription-name
my-instance-events
\ --source-identifiertest-instance-repl
輸出:
{ "EventSubscription": { "SubscriptionCreationTime": "Tue Jul 31 23:22:01 UTC 2018", "CustSubscriptionId": "my-instance-events", "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "Enabled": false, "Status": "modifying", "EventCategoriesList": [ "backup", "recovery" ], "CustomerAwsId": "123456789012", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events", "SourceType": "db-instance", "SourceIdsList": [ "test-instance", "test-instance-repl" ] } }
-
如需API詳細資訊,請參閱 命令參考 AddSourceIdentifierToSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 add-tags-to-resource
。
- AWS CLI
-
將標籤新增至資源
下列
add-tags-to-resource
範例會將標籤新增至RDS資料庫。aws rds add-tags-to-resource \ --resource-name
arn:aws:rds:us-east-1:123456789012:db:database-mysql
\ --tags "[{\"Key\": \"Name\",\"Value\": \"MyDatabase\"},{\"Key\": \"Environment\",\"Value\": \"test\"}]"此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon 使用者指南 中的標記 Amazon RDS 資源。 RDS
-
如需API詳細資訊,請參閱 命令參考 AddTagsToResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 apply-pending-maintenance-action
。
- AWS CLI
-
套用待定維護動作
下列
apply-pending-maintenance-action
範例會套用資料庫叢集的待定維護動作。aws rds apply-pending-maintenance-action \ --resource-identifier
arn:aws:rds:us-east-1:123456789012:cluster:my-db-cluster
\ --apply-actionsystem-update
\ --opt-in-typeimmediate
輸出:
{ "ResourcePendingMaintenanceActions": { "ResourceIdentifier": "arn:aws:rds:us-east-1:123456789012:cluster:my-db-cluster", "PendingMaintenanceActionDetails": [ { "Action": "system-update", "OptInStatus": "immediate", "CurrentApplyDate": "2021-01-23T01:07:36.100Z", "Description": "Upgrade to Aurora PostgreSQL 3.3.2" } ] } }
如需詳細資訊,請參閱Amazon RDS使用者指南中的維護資料庫執行個體,以及 Amazon Aurora 使用者指南中的維護 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 ApplyPendingMaintenanceAction
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 authorize-db-security-group-ingress
。
- AWS CLI
-
將 AWS Identity and Access Management (IAM) 角色與資料庫執行個體建立關聯
下列
authorize-db-security-group-ingress
範例使用 CIDR IP 範圍 192.0.2.0/24 的傳入規則設定預設安全群組。aws rds authorize-db-security-group-ingress \ --db-security-group-name
default
\ --cidrip192.0.2.0/24
輸出:
{ "DBSecurityGroup": { "OwnerId": "123456789012", "DBSecurityGroupName": "default", "DBSecurityGroupDescription": "default", "EC2SecurityGroups": [], "IPRanges": [ { "Status": "authorizing", "CIDRIP": "192.0.2.0/24" } ], "DBSecurityGroupArn": "arn:aws:rds:us-east-1:111122223333:secgrp:default" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的從 IP 範圍授權網路存取資料庫安全群組。
-
如需API詳細資訊,請參閱 命令參考 AuthorizeDbSecurityGroupIngress
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 backtrack-db-cluster
。
- AWS CLI
-
若要回溯 Aurora 資料庫叢集
下列
backtrack-db-cluster
範例會將指定的資料庫叢集 sample-cluster 回溯至 2018 年 3 月 19 日上午 10 點。aws rds backtrack-db-cluster --db-cluster-identifier
sample-cluster
--backtrack-to2018-03-19T10:00:00+00:00
此命令會輸出JSON區塊,以確認RDS資源的變更。
-
如需API詳細資訊,請參閱 命令參考 BacktrackDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 cancel-export-task
。
- AWS CLI
-
若要取消快照匯出至 Amazon S3
下列
cancel-export-task
範例會取消進行中的匯出任務,該任務正在將快照匯出至 Amazon S3。aws rds cancel-export-task \ --export-task-identifier
my-s3-export-1
輸出:
{ "ExportTaskIdentifier": "my-s3-export-1", "SourceArn": "arn:aws:rds:us-east-1:123456789012:snapshot:publisher-final-snapshot", "SnapshotTime": "2019-03-24T20:01:09.815Z", "S3Bucket": "mybucket", "S3Prefix": "", "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/export-snap-S3-role", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/abcd0000-7bfd-4594-af38-aabbccddeeff", "Status": "CANCELING", "PercentProgress": 0, "TotalExtractedDataInGB": 0 }
如需詳細資訊,請參閱 Amazon RDS 使用者指南中的取消快照匯出任務,或 Amazon Aurora 使用者指南 中的取消快照匯出任務。
-
如需API詳細資訊,請參閱 命令參考 CancelExportTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 copy-db-cluster-parameter-group
。
- AWS CLI
-
若要複製資料庫叢集參數群組
下列
copy-db-cluster-parameter-group
範例會複製資料庫叢集參數群組。aws rds copy-db-cluster-parameter-group \ --source-db-cluster-parameter-group-identifier
mydbclusterpg
\ --target-db-cluster-parameter-group-identifiermydbclusterpgcopy
\ --target-db-cluster-parameter-group-description"Copy of mydbclusterpg parameter group"
輸出:
{ "DBClusterParameterGroup": { "DBClusterParameterGroupName": "mydbclusterpgcopy", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:mydbclusterpgcopy", "DBParameterGroupFamily": "aurora-mysql5.7", "Description": "Copy of mydbclusterpg parameter group" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的複製資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 CopyDbClusterParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 copy-db-cluster-snapshot
。
- AWS CLI
-
若要複製資料庫叢集快照
下列
copy-db-cluster-snapshot
範例會建立資料庫叢集快照的副本,包括其標籤。aws rds copy-db-cluster-snapshot \ --source-db-cluster-snapshot-identifier
arn:aws:rds:us-east-1:123456789012:cluster-snapshot:rds:myaurora-2019-06-04-09-16
--target-db-cluster-snapshot-identifiermyclustersnapshotcopy
\ --copy-tags輸出:
{ "DBClusterSnapshot": { "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "DBClusterSnapshotIdentifier": "myclustersnapshotcopy", "DBClusterIdentifier": "myaurora", "SnapshotCreateTime": "2019-06-04T09:16:42.649Z", "Engine": "aurora-mysql", "AllocatedStorage": 0, "Status": "available", "Port": 0, "VpcId": "vpc-6594f31c", "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "MasterUsername": "myadmin", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LicenseModel": "aurora-mysql", "SnapshotType": "manual", "PercentProgress": 100, "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:myclustersnapshotcopy", "IAMDatabaseAuthenticationEnabled": false } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的複製快照。
-
如需API詳細資訊,請參閱 命令參考 CopyDbClusterSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 copy-db-parameter-group
。
- AWS CLI
-
若要複製資料庫叢集參數群組
下列
copy-db-parameter-group
範例會複製資料庫參數群組。aws rds copy-db-parameter-group \ --source-db-parameter-group-identifier
mydbpg
\ --target-db-parameter-group-identifiermydbpgcopy
\ --target-db-parameter-group-description"Copy of mydbpg parameter group"
輸出:
{ "DBParameterGroup": { "DBParameterGroupName": "mydbpgcopy", "DBParameterGroupArn": "arn:aws:rds:us-east-1:814387698303:pg:mydbpgcopy", "DBParameterGroupFamily": "mysql5.7", "Description": "Copy of mydbpg parameter group" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的複製資料庫參數群組。
-
如需API詳細資訊,請參閱 命令參考 CopyDbParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 copy-db-snapshot
。
- AWS CLI
-
若要複製資料庫快照
下列
copy-db-snapshot
範例會建立資料庫快照的副本。aws rds copy-db-snapshot \ --source-db-snapshot-identifier
rds:database-mysql-2019-06-06-08-38
--target-db-snapshot-identifiermydbsnapshotcopy
輸出:
{ "DBSnapshot": { "VpcId": "vpc-6594f31c", "Status": "creating", "Encrypted": true, "SourceDBSnapshotIdentifier": "arn:aws:rds:us-east-1:123456789012:snapshot:rds:database-mysql-2019-06-06-08-38", "MasterUsername": "admin", "Iops": 1000, "Port": 3306, "LicenseModel": "general-public-license", "DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mydbsnapshotcopy", "EngineVersion": "5.6.40", "OptionGroupName": "default:mysql-5-6", "ProcessorFeatures": [], "Engine": "mysql", "StorageType": "io1", "DbiResourceId": "db-ZI7UJ5BLKMBYFGX7FDENCKADC4", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "SnapshotType": "manual", "IAMDatabaseAuthenticationEnabled": false, "SourceRegion": "us-east-1", "DBInstanceIdentifier": "database-mysql", "InstanceCreateTime": "2019-04-30T15:45:53.663Z", "AvailabilityZone": "us-east-1f", "PercentProgress": 0, "AllocatedStorage": 100, "DBSnapshotIdentifier": "mydbsnapshotcopy" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的複製快照。
-
如需API詳細資訊,請參閱 命令參考 CopyDbSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 copy-option-group
。
- AWS CLI
-
複製選項群組
下列
copy-option-group
範例會複製選項群組。aws rds copy-option-group \ --source-option-group-identifier
myoptiongroup
\ --target-option-group-identifiernew-option-group
\ --target-option-group-description"My option group copy"
輸出:
{ "OptionGroup": { "Options": [], "OptionGroupName": "new-option-group", "MajorEngineVersion": "11.2", "OptionGroupDescription": "My option group copy", "AllowsVpcAndNonVpcInstanceMemberships": true, "EngineName": "oracle-ee", "OptionGroupArn": "arn:aws:rds:us-east-1:123456789012:og:new-option-group" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的複製選項群組。
-
如需API詳細資訊,請參閱 命令參考 CopyOptionGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-blue-green-deployment
。
- AWS CLI
-
範例 1:為RDS適用於 MySQL 資料庫執行個體的 建立藍/綠部署
下列
create-blue-green-deployment
範例會為 MySQL 資料庫執行個體建立藍/綠部署。aws rds create-blue-green-deployment \ --blue-green-deployment-name
bgd-cli-test-instance
\ --sourcearn:aws:rds:us-east-1:123456789012:db:my-db-instance
\ --target-engine-version8.0
\ --target-db-parameter-group-namemysql-80-group
輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-v53303651eexfake", "BlueGreenDeploymentName": "bgd-cli-test-instance", "Source": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "PENDING" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "PENDING" }, { "Name": "CONFIGURE_BACKUPS", "Status": "PENDING" }, { "Name": "CREATING_TOPOLOGY_OF_SOURCE", "Status": "PENDING" } ], "Status": "PROVISIONING", "CreateTime": "2022-02-25T21:18:51.183000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的建立藍/綠部署。
範例 2:為 Aurora MySQL 資料庫叢集建立藍/綠部署
下列
create-blue-green-deployment
範例會為 Aurora MySQL 資料庫叢集建立藍/綠部署。aws rds create-blue-green-deployment \ --blue-green-deployment-name
my-blue-green-deployment
\ --sourcearn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster
\ --target-engine-version8.0
\ --target-db-cluster-parameter-group-nameams-80-binlog-enabled
\ --target-db-parameter-group-namemysql-80-cluster-group
輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzglccsfake", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Status": "PROVISIONING" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "Status": "PROVISIONING" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "Status": "PROVISIONING" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "Status": "PROVISIONING" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "Status": "PROVISIONING" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "Status": "PROVISIONING" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "PENDING" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "PENDING" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "PENDING" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "PENDING" } ], "Status": "PROVISIONING", "CreateTime": "2022-02-25T21:12:00.288000+00:00" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立藍/綠部署。
-
如需API詳細資訊,請參閱 命令參考 CreateBlueGreenDeployment
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-cluster-endpoint
。
- AWS CLI
-
若要建立自訂資料庫叢集端點
下列
create-db-cluster-endpoint
範例會建立自訂資料庫叢集端點,並將其與指定的 Aurora 資料庫叢集建立關聯。aws rds create-db-cluster-endpoint \ --db-cluster-endpoint-identifier
mycustomendpoint
\ --endpoint-typereader
\ --db-cluster-identifiermydbcluster
\ --static-membersdbinstance1
dbinstance2
輸出:
{ "DBClusterEndpointIdentifier": "mycustomendpoint", "DBClusterIdentifier": "mydbcluster", "DBClusterEndpointResourceIdentifier": "cluster-endpoint-ANPAJ4AE5446DAEXAMPLE", "Endpoint": "mycustomendpoint.cluster-custom-cnpexample.us-east-1.rds.amazonaws.com", "Status": "creating", "EndpointType": "CUSTOM", "CustomEndpointType": "READER", "StaticMembers": [ "dbinstance1", "dbinstance2" ], "ExcludedMembers": [], "DBClusterEndpointArn": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:mycustomendpoint" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora Connection Management。
-
如需API詳細資訊,請參閱 命令參考 CreateDbClusterEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-cluster-parameter-group
。
- AWS CLI
-
若要建立資料庫叢集參數群組
下列
create-db-cluster-parameter-group
範例會建立資料庫叢集參數群組。aws rds create-db-cluster-parameter-group \ --db-cluster-parameter-group-name
mydbclusterparametergroup
\ --db-parameter-group-familyaurora5.6
\ --description"My new cluster parameter group"
輸出:
{ "DBClusterParameterGroup": { "DBClusterParameterGroupName": "mydbclusterparametergroup", "DBParameterGroupFamily": "aurora5.6", "Description": "My new cluster parameter group", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:mydbclusterparametergroup" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 CreateDbClusterParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-cluster-snapshot
。
- AWS CLI
-
若要建立資料庫叢集快照
下列
create-db-cluster-snapshot
範例會建立資料庫叢集快照。aws rds create-db-cluster-snapshot \ --db-cluster-identifier
mydbcluster
\ --db-cluster-snapshot-identifiermydbclustersnapshot
輸出:
{ "DBClusterSnapshot": { "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "DBClusterSnapshotIdentifier": "mydbclustersnapshot", "DBClusterIdentifier": "mydbcluster", "SnapshotCreateTime": "2019-06-18T21:21:00.469Z", "Engine": "aurora-mysql", "AllocatedStorage": 1, "Status": "creating", "Port": 0, "VpcId": "vpc-6594f31c", "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "MasterUsername": "myadmin", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LicenseModel": "aurora-mysql", "SnapshotType": "manual", "PercentProgress": 0, "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:mydbclustersnapshot", "IAMDatabaseAuthenticationEnabled": false } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立資料庫叢集快照。
-
如需API詳細資訊,請參閱 命令參考 CreateDbClusterSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-cluster
。
- AWS CLI
-
範例 1:建立 MySQL 5.7 相容資料庫叢集
下列
create-db-cluster
範例會使用預設引擎版本建立 MySQL 5.7 相容資料庫叢集。將範例密碼取代secret99
為安全密碼。當您使用主控台建立資料庫叢集時,Amazon RDS會自動為您的資料庫叢集建立寫入器資料庫執行個體。不過,當您使用 AWS CLI 建立資料庫叢集時,您必須使用create-db-instance
AWS CLI命令明確地為資料庫叢集建立寫入器資料庫執行個體。aws rds create-db-cluster \ --db-cluster-identifier
sample-cluster
\ --engineaurora-mysql
\ --engine-version5.7
\ --master-usernameadmin
\ --master-user-passwordsecret99
\ --db-subnet-group-namedefault
\ --vpc-security-group-idssg-0b9130572daf3dc16
輸出:
{ "DBCluster": { "DBSubnetGroup": "default", "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-0b9130572daf3dc16", "Status": "active" } ], "AllocatedStorage": 1, "AssociatedRoles": [], "PreferredBackupWindow": "09:12-09:42", "ClusterCreateTime": "2023-02-27T23:21:33.048Z", "DeletionProtection": false, "IAMDatabaseAuthenticationEnabled": false, "ReadReplicaIdentifiers": [], "EngineMode": "provisioned", "Engine": "aurora-mysql", "StorageEncrypted": false, "MultiAZ": false, "PreferredMaintenanceWindow": "mon:04:31-mon:05:01", "HttpEndpointEnabled": false, "BackupRetentionPeriod": 1, "DbClusterResourceId": "cluster-ANPAJ4AE5446DAEXAMPLE", "DBClusterIdentifier": "sample-cluster", "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "MasterUsername": "master", "EngineVersion": "5.7.mysql_aurora.2.11.1", "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:sample-cluster", "DBClusterMembers": [], "Port": 3306, "Status": "creating", "Endpoint": "sample-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", "DBClusterParameterGroup": "default.aurora-mysql5.7", "HostedZoneId": "Z2R2ITUGPM61AM", "ReaderEndpoint": "sample-cluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "CopyTagsToSnapshot": false } }
範例 2:建立 Postgre SQL- 相容資料庫叢集
下列
create-db-cluster
範例會使用預設引擎版本建立 Postgre SQL相容資料庫叢集。將範例密碼取代secret99
為安全密碼。當您使用主控台建立資料庫叢集時,Amazon RDS會自動為您的資料庫叢集建立寫入器資料庫執行個體。不過,當您使用 AWS CLI 建立資料庫叢集時,您必須使用create-db-instance
AWS CLI命令明確地為資料庫叢集建立寫入器資料庫執行個體。aws rds create-db-cluster \ --db-cluster-identifier
sample-pg-cluster
\ --engineaurora-postgresql
\ --master
-username master \ --master-user-passwordsecret99
\ --db-subnet-group-namedefault
\ --vpc-security-group-idssg-0b9130572daf3dc16
輸出:
{ "DBCluster": { "Endpoint": "sample-pg-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", "HttpEndpointEnabled": false, "DBClusterMembers": [], "EngineMode": "provisioned", "CopyTagsToSnapshot": false, "HostedZoneId": "Z2R2ITUGPM61AM", "IAMDatabaseAuthenticationEnabled": false, "AllocatedStorage": 1, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-0b9130572daf3dc16", "Status": "active" } ], "DeletionProtection": false, "StorageEncrypted": false, "BackupRetentionPeriod": 1, "PreferredBackupWindow": "09:56-10:26", "ClusterCreateTime": "2023-02-27T23:26:08.371Z", "DBClusterParameterGroup": "default.aurora-postgresql13", "EngineVersion": "13.7", "Engine": "aurora-postgresql", "Status": "creating", "DBClusterIdentifier": "sample-pg-cluster", "MultiAZ": false, "Port": 5432, "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:sample-pg-cluster", "AssociatedRoles": [], "DbClusterResourceId": "cluster-ANPAJ4AE5446DAEXAMPLE", "PreferredMaintenanceWindow": "wed:03:33-wed:04:03", "ReaderEndpoint": "sample-pg-cluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "MasterUsername": "master", "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c" ], "ReadReplicaIdentifiers": [], "DBSubnetGroup": "default" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 CreateDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-instance-read-replica
。
- AWS CLI
-
若要建立資料庫執行個體僅供讀取複本
此範例會建立名為 的現有資料庫執行個體的僅供讀取複本
test-instance
。僅供讀取複本名為test-instance-repl
。aws rds create-db-instance-read-replica \ --db-instance-identifier
test-instance-repl
\ --source-db-instance-identifiertest-instance
輸出:
{ "DBInstance": { "IAMDatabaseAuthenticationEnabled": false, "MonitoringInterval": 0, "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance-repl", "ReadReplicaSourceDBInstanceIdentifier": "test-instance", "DBInstanceIdentifier": "test-instance-repl", ...some output truncated... } }
-
如需API詳細資訊,請參閱 命令參考 CreateDbInstanceReadReplica
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-instance
。
- AWS CLI
-
建立資料庫執行個體
下列
create-db-instance
範例使用所需的選項來啟動新的資料庫執行個體。aws rds create-db-instance \ --db-instance-identifier
test-mysql-instance
\ --db-instance-classdb.t3.micro
\ --enginemysql
\ --master-usernameadmin
\ --master-user-passwordsecret99
\ --allocated-storage20
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "test-mysql-instance", "DBInstanceClass": "db.t3.micro", "Engine": "mysql", "DBInstanceStatus": "creating", "MasterUsername": "admin", "AllocatedStorage": 20, "PreferredBackupWindow": "12:55-13:25", "BackupRetentionPeriod": 1, "DBSecurityGroups": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-12345abc", "Status": "active" } ], "DBParameterGroups": [ { "DBParameterGroupName": "default.mysql5.7", "ParameterApplyStatus": "in-sync" } ], "DBSubnetGroup": { "DBSubnetGroupName": "default", "DBSubnetGroupDescription": "default", "VpcId": "vpc-2ff2ff2f", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-west-2c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-west-2d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-west-2a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-west-2b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "sun:08:07-sun:08:37", "PendingModifiedValues": { "MasterUserPassword": "****" }, "MultiAZ": false, "EngineVersion": "5.7.22", "AutoMinorVersionUpgrade": true, "ReadReplicaDBInstanceIdentifiers": [], "LicenseModel": "general-public-license", "OptionGroupMemberships": [ { "OptionGroupName": "default:mysql-5-7", "Status": "in-sync" } ], "PubliclyAccessible": true, "StorageType": "gp2", "DbInstancePort": 0, "StorageEncrypted": false, "DbiResourceId": "db-5555EXAMPLE44444444EXAMPLE", "CACertificateIdentifier": "rds-ca-2019", "DomainMemberships": [], "CopyTagsToSnapshot": false, "MonitoringInterval": 0, "DBInstanceArn": "arn:aws:rds:us-west-2:123456789012:db:test-mysql-instance", "IAMDatabaseAuthenticationEnabled": false, "PerformanceInsightsEnabled": false, "DeletionProtection": false, "AssociatedRoles": [] } }
如需詳細資訊,請參閱 Amazon 使用者指南 中的建立 Amazon RDS 資料庫執行個體。 RDS
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 CreateDBInstance
。
-
下列程式碼範例示範如何使用 create-db-parameter-group
。
- AWS CLI
-
若要建立資料庫參數群組
下列
create-db-parameter-group
範例會建立資料庫參數群組。aws rds create-db-parameter-group \ --db-parameter-group-name
mydbparametergroup
\ --db-parameter-group-familyMySQL5.6
\ --description"My new parameter group"
輸出:
{ "DBParameterGroup": { "DBParameterGroupName": "mydbparametergroup", "DBParameterGroupFamily": "mysql5.6", "Description": "My new parameter group", "DBParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:pg:mydbparametergroup" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的建立資料庫參數群組。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 C reateDBParameter群組
。
-
下列程式碼範例示範如何使用 create-db-proxy-endpoint
。
- AWS CLI
-
為RDS資料庫建立資料庫代理端點
下列
create-db-proxy-endpoint
範例會建立資料庫代理端點。aws rds create-db-proxy-endpoint \ --db-proxy-name
proxyExample
\ --db-proxy-endpoint-name"proxyep1"
\ --vpc-subnet-idssubnetgroup1
subnetgroup2
輸出:
{ "DBProxyEndpoint": { "DBProxyEndpointName": "proxyep1", "DBProxyEndpointArn": "arn:aws:rds:us-east-1:123456789012:db-proxy-endpoint:prx-endpoint-0123a01b12345c0ab", "DBProxyName": "proxyExample", "Status": "creating", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234", "sg-5678" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Endpoint": "proxyep1.endpoint.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "TargetRole": "READ_WRITE", "IsDefault": false } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的建立代理端點和 Amazon Aurora 使用者指南中的建立代理端點。
-
如需API詳細資訊,請參閱 命令參考 CreateDbProxyEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-proxy
。
- AWS CLI
-
為RDS資料庫建立資料庫代理
下列
create-db-proxy
範例會建立資料庫代理。aws rds create-db-proxy \ --db-proxy-name
proxyExample
\ --engine-familyMYSQL
\ --auth Description="proxydescription1",AuthScheme="SECRETS",SecretArn="arn:aws:secretsmanager:us-west-2:123456789123:secret:secretName-1234f",IAMAuth="DISABLED",ClientPasswordAuthType="MYSQL_NATIVE_PASSWORD" \ --role-arnarn:aws:iam::123456789123:role/ProxyRole
\ --vpc-subnet-idssubnetgroup1
subnetgroup2
輸出:
{ "DBProxy": { "DBProxyName": "proxyExample", "DBProxyArn": "arn:aws:rds:us-east-1:123456789012:db-proxy:prx-0123a01b12345c0ab", "EngineFamily": "MYSQL", "VpcId": "vpc-1234567", "VpcSecuritytGroupIds": [ "sg-1234", "sg-5678", "sg-9101" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Auth": "[ { "Description": "proxydescription1", "AuthScheme": "SECRETS", "SecretArn": "arn:aws:secretsmanager:us-west-2:123456789123:secret:proxysecret1-Abcd1e", "IAMAuth": "DISABLED" } ]", "RoleArn": "arn:aws:iam::12345678912:role/ProxyRole", "Endpoint": "proxyExample.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "RequireTLS": false, "IdleClientTimeout": 1800, "DebuggingLogging": false, "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "UpdatedDate": "2023-04-13T01:49:38.568000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的建立RDS代理和 Amazon Aurora 使用者指南中的建立RDS代理。
-
如需API詳細資訊,請參閱 命令參考 CreateDbProxy
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-security-group
。
- AWS CLI
-
若要建立 Amazon RDS 資料庫安全群組
下列
create-db-security-group
命令會建立新的 Amazon RDS 資料庫安全群組:aws rds create-db-security-group --db-security-group-name
mysecgroup
--db-security-group-description"My Test Security Group"
在此範例中,新的資料庫安全群組已命名
mysecgroup
並具有描述。輸出:
{ "DBSecurityGroup": { "OwnerId": "123456789012", "DBSecurityGroupName": "mysecgroup", "DBSecurityGroupDescription": "My Test Security Group", "VpcId": "vpc-a1b2c3d4", "EC2SecurityGroups": [], "IPRanges": [], "DBSecurityGroupArn": "arn:aws:rds:us-west-2:123456789012:secgrp:mysecgroup" } }
-
如需API詳細資訊,請參閱 命令參考 CreateDbSecurityGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-shard-group
。
- AWS CLI
-
範例 1:建立 Aurora PostgreSQL 主要資料庫叢集
下列
create-db-cluster
範例會建立與 Aurora Serverless v2 和 Aurora Limitless Database 相容的 Aurora PostgreSQL SQL主要資料庫叢集。aws rds create-db-cluster \ --db-cluster-identifier
my-sv2-cluster
\ --engineaurora-postgresql
\ --engine-version15.2-limitless
\ --storage-typeaurora-iopt1
\ --serverless-v2-scaling-configurationMinCapacity=2,MaxCapacity=16
\ --enable-limitless-database \ --master-usernamemyuser
\ --master-user-passwordmypassword
\ --enable-cloudwatch-logs-exportspostgresql
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-east-2b", "us-east-2c", "us-east-2a" ], "BackupRetentionPeriod": 1, "DBClusterIdentifier": "my-sv2-cluster", "DBClusterParameterGroup": "default.aurora-postgresql15", "DBSubnetGroup": "default", "Status": "creating", "Endpoint": "my-sv2-cluster.cluster-cekycexample.us-east-2.rds.amazonaws.com", "ReaderEndpoint": "my-sv2-cluster.cluster-ro-cekycexample.us-east-2.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora-postgresql", "EngineVersion": "15.2-limitless", "Port": 5432, "MasterUsername": "myuser", "PreferredBackupWindow": "06:05-06:35", "PreferredMaintenanceWindow": "mon:08:25-mon:08:55", "ReadReplicaIdentifiers": [], "DBClusterMembers": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-########", "Status": "active" } ], "HostedZoneId": "Z2XHWR1EXAMPLE", "StorageEncrypted": false, "DbClusterResourceId": "cluster-XYEDT6ML6FHIXH4Q2J1EXAMPLE", "DBClusterArn": "arn:aws:rds:us-east-2:123456789012:cluster:my-sv2-cluster", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "ClusterCreateTime": "2024-02-19T16:24:07.771000+00:00", "EnabledCloudwatchLogsExports": [ "postgresql" ], "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false, "CopyTagsToSnapshot": false, "CrossAccountClone": false, "DomainMemberships": [], "TagList": [], "StorageType": "aurora-iopt1", "AutoMinorVersionUpgrade": true, "ServerlessV2ScalingConfiguration": { "MinCapacity": 2.0, "MaxCapacity": 16.0 }, "NetworkType": "IPV4", "IOOptimizedNextAllowedModificationTime": "2024-03-21T16:24:07.781000+00:00", "LimitlessDatabase": { "Status": "not-in-use", "MinRequiredACU": 96.0 } } }
範例 2:建立主要 (寫入器) 資料庫執行個體
下列
create-db-instance
範例會建立 Aurora Serverless v2 主要 (寫入器) 資料庫執行個體。當您使用主控台建立資料庫叢集時,Amazon RDS會自動為您的資料庫叢集建立寫入器資料庫執行個體。不過,當您使用 AWS CLI 建立資料庫叢集時,您必須使用create-db-instance
AWS CLI命令明確地為資料庫叢集建立寫入器資料庫執行個體。aws rds create-db-instance \ --db-instance-identifier
my-sv2-instance
\ --db-cluster-identifiermy-sv2-cluster
\ --engineaurora-postgresql
\ --db-instance-classdb.serverless
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "my-sv2-instance", "DBInstanceClass": "db.serverless", "Engine": "aurora-postgresql", "DBInstanceStatus": "creating", "MasterUsername": "myuser", "AllocatedStorage": 1, "PreferredBackupWindow": "06:05-06:35", "BackupRetentionPeriod": 1, "DBSecurityGroups": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-########", "Status": "active" } ], "DBParameterGroups": [ { "DBParameterGroupName": "default.aurora-postgresql15", "ParameterApplyStatus": "in-sync" } ], "DBSubnetGroup": { "DBSubnetGroupName": "default", "DBSubnetGroupDescription": "default", "VpcId": "vpc-########", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-east-2c" }, "SubnetOutpost": {}, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-east-2a" }, "SubnetOutpost": {}, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-########", "SubnetAvailabilityZone": { "Name": "us-east-2b" }, "SubnetOutpost": {}, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "fri:09:01-fri:09:31", "PendingModifiedValues": { "PendingCloudwatchLogsExports": { "LogTypesToEnable": [ "postgresql" ] } }, "MultiAZ": false, "EngineVersion": "15.2-limitless", "AutoMinorVersionUpgrade": true, "ReadReplicaDBInstanceIdentifiers": [], "LicenseModel": "postgresql-license", "OptionGroupMemberships": [ { "OptionGroupName": "default:aurora-postgresql-15", "Status": "in-sync" } ], "PubliclyAccessible": false, "StorageType": "aurora-iopt1", "DbInstancePort": 0, "DBClusterIdentifier": "my-sv2-cluster", "StorageEncrypted": false, "DbiResourceId": "db-BIQTE3B3K3RM7M74SK5EXAMPLE", "CACertificateIdentifier": "rds-ca-rsa2048-g1", "DomainMemberships": [], "CopyTagsToSnapshot": false, "MonitoringInterval": 0, "PromotionTier": 1, "DBInstanceArn": "arn:aws:rds:us-east-2:123456789012:db:my-sv2-instance", "IAMDatabaseAuthenticationEnabled": false, "PerformanceInsightsEnabled": false, "DeletionProtection": false, "AssociatedRoles": [], "TagList": [], "CustomerOwnedIpEnabled": false, "BackupTarget": "region", "NetworkType": "IPV4", "StorageThroughput": 0, "CertificateDetails": { "CAIdentifier": "rds-ca-rsa2048-g1" }, "DedicatedLogVolume": false } }
範例 3:建立資料庫碎片群組
下列
create-db-shard-group
範例會在 Aurora PostgreSQL 主要資料庫叢集中建立資料庫碎片群組。aws rds create-db-shard-group \ --db-shard-group-identifier
my-db-shard-group
\ --db-cluster-identifiermy-sv2-cluster
\ --max-acu768
輸出:
{ "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "creating", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用 Aurora Serverless v2。
-
如需API詳細資訊,請參閱 命令參考 CreateDbShardGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-db-snapshot
。
- AWS CLI
-
若要建立資料庫快照
下列
create-db-snapshot
範例會建立資料庫快照。aws rds create-db-snapshot \ --db-instance-identifier
database-mysql
\ --db-snapshot-identifiermydbsnapshot
輸出:
{ "DBSnapshot": { "DBSnapshotIdentifier": "mydbsnapshot", "DBInstanceIdentifier": "database-mysql", "Engine": "mysql", "AllocatedStorage": 100, "Status": "creating", "Port": 3306, "AvailabilityZone": "us-east-1b", "VpcId": "vpc-6594f31c", "InstanceCreateTime": "2019-04-30T15:45:53.663Z", "MasterUsername": "admin", "EngineVersion": "5.6.40", "LicenseModel": "general-public-license", "SnapshotType": "manual", "Iops": 1000, "OptionGroupName": "default:mysql-5-6", "PercentProgress": 0, "StorageType": "io1", "Encrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mydbsnapshot", "IAMDatabaseAuthenticationEnabled": false, "ProcessorFeatures": [], "DbiResourceId": "db-AKIAIOSFODNN7EXAMPLE" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的建立資料庫快照。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 CreateDBSnapshot
。
-
下列程式碼範例示範如何使用 create-db-subnet-group
。
- AWS CLI
-
若要建立資料庫子網路群組
下列
create-db-subnet-group
範例mysubnetgroup
會使用現有的子網路建立名為 的資料庫子網路群組。aws rds create-db-subnet-group \ --db-subnet-group-name
mysubnetgroup
\ --db-subnet-group-description"test DB subnet group"
\ --subnet-ids '["subnet-0a1dc4e1a6f123456","subnet-070dd7ecb3aaaaaaa","subnet-00f5b198bc0abcdef"]
'輸出:
{ "DBSubnetGroup": { "DBSubnetGroupName": "mysubnetgroup", "DBSubnetGroupDescription": "test DB subnet group", "VpcId": "vpc-0f08e7610a1b2c3d4", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-070dd7ecb3aaaaaaa", "SubnetAvailabilityZone": { "Name": "us-west-2b" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-00f5b198bc0abcdef", "SubnetAvailabilityZone": { "Name": "us-west-2d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-0a1dc4e1a6f123456", "SubnetAvailabilityZone": { "Name": "us-west-2b" }, "SubnetStatus": "Active" } ], "DBSubnetGroupArn": "arn:aws:rds:us-west-2:0123456789012:subgrp:mysubnetgroup" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的在 中建立資料庫執行個體VPC。
-
如需API詳細資訊,請參閱 命令參考 CreateDbSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-event-subscription
。
- AWS CLI
-
若要建立事件訂閱
下列
create-event-subscription
範例會為目前 AWS 帳戶中的資料庫執行個體建立備份和復原事件的訂閱。通知會傳送至 指定的 Amazon Simple Notification Service 主題--sns-topic-arn
。aws rds create-event-subscription \ --subscription-name
my-instance-events
\ --source-typedb-instance
\ --event-categories '["backup","recovery"]
' \ --sns-topic-arnarn:aws:sns:us-east-1:123456789012:interesting-events
輸出:
{ "EventSubscription": { "Status": "creating", "CustSubscriptionId": "my-instance-events", "SubscriptionCreationTime": "Tue Jul 31 23:22:01 UTC 2018", "EventCategoriesList": [ "backup", "recovery" ], "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events", "CustomerAwsId": "123456789012", "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "SourceType": "db-instance", "Enabled": true } }
-
如需API詳細資訊,請參閱 命令參考 CreateEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-global-cluster
。
- AWS CLI
-
建立全域資料庫叢集
下列
create-global-cluster
範例會建立新的 Aurora My SQL相容的全域資料庫叢集。aws rds create-global-cluster \ --global-cluster-identifier
myglobalcluster
\ --engineaurora-mysql
輸出:
{ "GlobalCluster": { "GlobalClusterIdentifier": "myglobalcluster", "GlobalClusterResourceId": "cluster-f0e523bfe07aabb", "GlobalClusterArn": "arn:aws:rds::123456789012:global-cluster:myglobalcluster", "Status": "available", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.07.2", "StorageEncrypted": false, "DeletionProtection": false, "GlobalClusterMembers": [] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立 Aurora 全域資料庫。
-
如需API詳細資訊,請參閱 命令參考 CreateGlobalCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-option-group
。
- AWS CLI
-
若要建立 Amazon RDS選項群組
下列
create-option-group
命令會為Oracle Enterprise Edition
版本建立新的 Amazon RDS選項群組,11.2`, is named ``MyOptionGroup
並包含描述。aws rds create-option-group \ --option-group-name
MyOptionGroup
\ --engine-nameoracle-ee
\ --major-engine-version11.2
\ --option-group-description"Oracle Database Manager Database Control"
輸出:
{ "OptionGroup": { "OptionGroupName": "myoptiongroup", "OptionGroupDescription": "Oracle Database Manager Database Control", "EngineName": "oracle-ee", "MajorEngineVersion": "11.2", "Options": [], "AllowsVpcAndNonVpcInstanceMemberships": true, "OptionGroupArn": "arn:aws:rds:us-west-2:123456789012:og:myoptiongroup" } }
-
如需API詳細資訊,請參閱 命令參考 CreateOptionGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-blue-green-deployment
。
- AWS CLI
-
範例 1:刪除RDS適用於 MySQL 資料庫執行個體的綠色環境中的資源
下列
delete-blue-green-deployment
範例會刪除RDS適用於 MySQL 資料庫執行個體的綠色環境中的資源。aws rds delete-blue-green-deployment \ --blue-green-deployment-identifier
bgd-v53303651eexfake
\ --delete-target輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-v53303651eexfake", "BlueGreenDeploymentName": "bgd-cli-test-instance", "Source": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "Target": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-rkfbpe", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-rkfbpe", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1-green-j382ha", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2-green-ejv4ao", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3-green-vlpz3t", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CONFIGURE_BACKUPS", "Status": "COMPLETED" }, { "Name": "CREATING_TOPOLOGY_OF_SOURCE", "Status": "COMPLETED" } ], "Status": "DELETING", "CreateTime": "2022-02-25T21:18:51.183000+00:00", "DeleteTime": "2022-02-25T22:25:31.331000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的刪除藍/綠部署。
範例 2:刪除 Aurora MySQL 資料庫叢集綠色環境中的資源
下列
delete-blue-green-deployment
範例會刪除 Aurora MySQL 資料庫叢集綠色環境中的資源。aws rds delete-blue-green-deployment \ --blue-green-deployment-identifier
bgd-wi89nwzglccsfake
\ --delete-target輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzglccsfake", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Target": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1-green-gpmaxf", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2-green-j2oajq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3-green-mkxies", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint-green-4sqjrq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint-green-gwwzlg", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "COMPLETED" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "COMPLETED" } ], "Status": "DELETING", "CreateTime": "2022-02-25T21:12:00.288000+00:00", "DeleteTime": "2022-02-25T22:29:11.336000+00:00" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的刪除藍/綠部署。
-
如需API詳細資訊,請參閱 命令參考 DeleteBlueGreenDeployment
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-cluster-endpoint
。
- AWS CLI
-
若要刪除自訂資料庫叢集端點
下列
delete-db-cluster-endpoint
範例會刪除指定的自訂資料庫叢集端點。aws rds delete-db-cluster-endpoint \ --db-cluster-endpoint-identifier
mycustomendpoint
輸出:
{ "DBClusterEndpointIdentifier": "mycustomendpoint", "DBClusterIdentifier": "mydbcluster", "DBClusterEndpointResourceIdentifier": "cluster-endpoint-ANPAJ4AE5446DAEXAMPLE", "Endpoint": "mycustomendpoint.cluster-custom-cnpexample.us-east-1.rds.amazonaws.com", "Status": "deleting", "EndpointType": "CUSTOM", "CustomEndpointType": "READER", "StaticMembers": [ "dbinstance1", "dbinstance2", "dbinstance3" ], "ExcludedMembers": [], "DBClusterEndpointArn": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:mycustomendpoint" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora Connection Management。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbClusterEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-cluster-parameter-group
。
- AWS CLI
-
若要刪除資料庫叢集參數群組
下列
delete-db-cluster-parameter-group
範例會刪除指定的資料庫叢集參數群組。aws rds delete-db-cluster-parameter-group \ --db-cluster-parameter-group-name
mydbclusterparametergroup
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbClusterParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-cluster-snapshot
。
- AWS CLI
-
若要刪除資料庫叢集快照
下列
delete-db-cluster-snapshot
範例會刪除指定的資料庫叢集快照。aws rds delete-db-cluster-snapshot \ --db-cluster-snapshot-identifier
mydbclustersnapshot
輸出:
{ "DBClusterSnapshot": { "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "DBClusterSnapshotIdentifier": "mydbclustersnapshot", "DBClusterIdentifier": "mydbcluster", "SnapshotCreateTime": "2019-06-18T21:21:00.469Z", "Engine": "aurora-mysql", "AllocatedStorage": 0, "Status": "available", "Port": 0, "VpcId": "vpc-6594f31c", "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "MasterUsername": "myadmin", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LicenseModel": "aurora-mysql", "SnapshotType": "manual", "PercentProgress": 100, "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:mydbclustersnapshot", "IAMDatabaseAuthenticationEnabled": false } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的刪除快照。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbClusterSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-cluster
。
- AWS CLI
-
範例 1:在資料庫叢集中刪除資料庫執行個體
下列
delete-db-instance
範例會刪除資料庫叢集中的最終資料庫執行個體。如果資料庫叢集包含未處於刪除狀態的資料庫執行個體,則無法刪除該資料庫叢集。在資料庫叢集中刪除資料庫執行個體時,您無法拍攝最終快照。aws rds delete-db-instance \ --db-instance-identifier
database-3
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "database-3", "DBInstanceClass": "db.r4.large", "Engine": "aurora-postgresql", "DBInstanceStatus": "deleting", ...output omitted... } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的在 Aurora 資料庫叢集中刪除資料庫執行個體。
範例 2:刪除資料庫叢集
下列
delete-db-cluster
範例會刪除名為 的資料庫叢集,mycluster
並拍攝名為 的最終快照mycluster-final-snapshot
。資料庫叢集的狀態可在擷取快照時使用。若要遵循刪除的進度,請使用describe-db-clusters
CLI命令。aws rds delete-db-cluster \ --db-cluster-identifier
mycluster
\ --no-skip-final-snapshot \ --final-db-snapshot-identifiermycluster-final-snapshot
輸出:
{ "DBCluster": { "AllocatedStorage": 20, "AvailabilityZones": [ "eu-central-1b", "eu-central-1c", "eu-central-1a" ], "BackupRetentionPeriod": 7, "DBClusterIdentifier": "mycluster", "DBClusterParameterGroup": "default.aurora-postgresql10", "DBSubnetGroup": "default-vpc-aa11bb22", "Status": "available", ...output omitted... } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的具有單一資料庫執行個體的 Aurora 叢集。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-instance-automated-backup
。
- AWS CLI
-
從 區域刪除複寫的自動備份
下列
delete-db-instance-automated-backup
範例會刪除具有指定 Amazon Resource Name () 的自動備份ARN。aws rds delete-db-instance-automated-backup \ --db-instance-automated-backups-arn
"arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example"
輸出:
{ "DBInstanceAutomatedBackup": { "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:new-orcl-db", "DbiResourceId": "db-JKIB2GFQ5RV7REPLZA4EXAMPLE", "Region": "us-east-1", "DBInstanceIdentifier": "new-orcl-db", "RestoreWindow": {}, "AllocatedStorage": 20, "Status": "deleting", "Port": 1521, "AvailabilityZone": "us-east-1b", "VpcId": "vpc-########", "InstanceCreateTime": "2020-12-04T15:28:31Z", "MasterUsername": "admin", "Engine": "oracle-se2", "EngineVersion": "12.1.0.2.v21", "LicenseModel": "bring-your-own-license", "OptionGroupName": "default:oracle-se2-12-1", "Encrypted": false, "StorageType": "gp2", "IAMDatabaseAuthenticationEnabled": false, "BackupRetentionPeriod": 7, "DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的刪除複寫備份。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbInstanceAutomatedBackup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-instance
。
- AWS CLI
-
若要刪除資料庫執行個體
下列
delete-db-instance
範例會在建立名為 的最終資料庫快照後刪除指定的資料庫執行個體test-instance-final-snap
。aws rds delete-db-instance \ --db-instance-identifier
test-instance
\ --final-db-snapshot-identifiertest-instance-final-snap
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "test-instance", "DBInstanceStatus": "deleting", ...some output truncated... } }
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 DeleteDBInstance
。
-
下列程式碼範例示範如何使用 delete-db-parameter-group
。
- AWS CLI
-
若要刪除資料庫參數群組
下列
command
範例會刪除資料庫參數群組。aws rds delete-db-parameter-group \ --db-parameter-group-name
mydbparametergroup
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用資料庫參數群組。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 D eleteDBParameter群組
。
-
下列程式碼範例示範如何使用 delete-db-proxy-endpoint
。
- AWS CLI
-
刪除RDS資料庫的資料庫代理端點
下列
delete-db-proxy-endpoint
範例會刪除目標資料庫的資料庫代理端點。aws rds delete-db-proxy-endpoint \ --db-proxy-endpoint-name
proxyEP1
輸出:
{ "DBProxyEndpoint": { "DBProxyEndpointName": "proxyEP1", "DBProxyEndpointArn": "arn:aws:rds:us-east-1:123456789012:db-proxy-endpoint:prx-endpoint-0123a01b12345c0ab", "DBProxyName": "proxyExample", "Status": "deleting", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234", "sg-5678" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Endpoint": "proxyEP1.endpoint.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "CreatedDate": "2023-04-13T01:49:38.568000+00:00", "TargetRole": "READ_ONLY", "IsDefault": false } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的刪除代理端點和 Amazon Aurora 使用者指南中的刪除代理端點。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbProxyEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-proxy
。
- AWS CLI
-
刪除RDS資料庫的資料庫代理
下列
delete-db-proxy
範例會刪除資料庫代理。aws rds delete-db-proxy \ --db-proxy-name
proxyExample
輸出:
{ "DBProxy": { "DBProxyName": "proxyExample", "DBProxyArn": "arn:aws:rds:us-east-1:123456789012:db-proxy:prx-0123a01b12345c0ab", "Status": "deleting", "EngineFamily": "PostgreSQL", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234", "sg-5678" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Auth": "[ { "Description": "proxydescription`" "AuthScheme": "SECRETS", "SecretArn": "arn:aws:secretsmanager:us-west-2:123456789123:secret:proxysecret1-Abcd1e", "IAMAuth": "DISABLED" } ], "RoleArn": "arn:aws:iam::12345678912:role/ProxyPostgreSQLRole", "Endpoint": "proxyExample.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "RequireTLS": false, "IdleClientTimeout": 1800, "DebuggingLogging": false, "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "UpdatedDate": "2023-04-13T01:49:38.568000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的刪除RDS代理,以及 Amazon Aurora 使用者指南中的刪除RDS代理。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbProxy
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-security-group
。
- AWS CLI
-
若要刪除資料庫安全群組
下列
delete-db-security-group
範例會刪除名為 的資料庫安全群組mysecuritygroup
。aws rds delete-db-security-group \ --db-security-group-name
mysecuritygroup
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用資料庫安全群組 (EC2-Classic 平台)。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbSecurityGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-shard-group
。
- AWS CLI
-
範例 1:刪除資料庫碎片群組失敗
下列
delete-db-shard-group
範例顯示當您嘗試刪除資料庫碎片群組,然後再刪除所有資料庫和結構描述時發生的錯誤。aws rds delete-db-shard-group \ --db-shard-group-identifier
limitless-test-shard-grp
輸出:
An error occurred (InvalidDBShardGroupState) when calling the DeleteDBShardGroup operation: Unable to delete the DB shard group limitless-test-db-shard-group. Delete all of your Limitless Database databases and schemas, then try again.
範例 2:成功刪除資料庫碎片群組
在您刪除所有資料庫和結構描述後,下列
delete-db-shard-group
範例會刪除資料庫碎片群組,包括public
結構描述。aws rds delete-db-shard-group \ --db-shard-group-identifier
limitless-test-shard-grp
輸出:
{ "DBShardGroupResourceId": "shardgroup-7bb446329da94788b3f957746example", "DBShardGroupIdentifier": "limitless-test-shard-grp", "DBClusterIdentifier": "limitless-test-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "deleting", "PubliclyAccessible": true, "Endpoint": "limitless-test-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的刪除 Aurora 資料庫叢集和資料庫執行個體。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbShardGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-snapshot
。
- AWS CLI
-
若要刪除資料庫快照
下列
delete-db-snapshot
範例會刪除指定的資料庫快照。aws rds delete-db-snapshot \ --db-snapshot-identifier
mydbsnapshot
輸出:
{ "DBSnapshot": { "DBSnapshotIdentifier": "mydbsnapshot", "DBInstanceIdentifier": "database-mysql", "SnapshotCreateTime": "2019-06-18T22:08:40.702Z", "Engine": "mysql", "AllocatedStorage": 100, "Status": "deleted", "Port": 3306, "AvailabilityZone": "us-east-1b", "VpcId": "vpc-6594f31c", "InstanceCreateTime": "2019-04-30T15:45:53.663Z", "MasterUsername": "admin", "EngineVersion": "5.6.40", "LicenseModel": "general-public-license", "SnapshotType": "manual", "Iops": 1000, "OptionGroupName": "default:mysql-5-6", "PercentProgress": 100, "StorageType": "io1", "Encrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mydbsnapshot", "IAMDatabaseAuthenticationEnabled": false, "ProcessorFeatures": [], "DbiResourceId": "db-AKIAIOSFODNN7EXAMPLE" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的刪除快照。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-db-subnet-group
。
- AWS CLI
-
若要刪除資料庫子網路群組
下列
delete-db-subnet-group
範例會刪除名為 的資料庫子網路群組mysubnetgroup
。aws rds delete-db-subnet-group --db-subnet-group-name
mysubnetgroup
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS 使用者指南 中的使用 資料庫執行個體VPC。
-
如需API詳細資訊,請參閱 命令參考 DeleteDbSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-event-subscription
。
- AWS CLI
-
若要刪除事件訂閱
下列
delete-event-subscription
範例會刪除指定的事件訂閱。aws rds delete-event-subscription --subscription-name
my-instance-events
輸出:
{ "EventSubscription": { "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "CustomerAwsId": "123456789012", "Enabled": false, "SourceIdsList": [ "test-instance" ], "SourceType": "db-instance", "EventCategoriesList": [ "backup", "recovery" ], "SubscriptionCreationTime": "2018-07-31 23:22:01.893", "CustSubscriptionId": "my-instance-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events", "Status": "deleting" } }
-
如需API詳細資訊,請參閱 命令參考 DeleteEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-global-cluster
。
- AWS CLI
-
若要刪除全域資料庫叢集
下列
delete-global-cluster
範例會刪除 Aurora My SQL相容的全域資料庫叢集。輸出會顯示您要刪除的叢集,但後續describe-global-clusters
命令不會列出該資料庫叢集。aws rds delete-global-cluster \ --global-cluster-identifier
myglobalcluster
輸出:
{ "GlobalCluster": { "GlobalClusterIdentifier": "myglobalcluster", "GlobalClusterResourceId": "cluster-f0e523bfe07aabb", "GlobalClusterArn": "arn:aws:rds::123456789012:global-cluster:myglobalcluster", "Status": "available", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.07.2", "StorageEncrypted": false, "DeletionProtection": false, "GlobalClusterMembers": [] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的刪除 Aurora 全域資料庫。
-
如需API詳細資訊,請參閱 命令參考 DeleteGlobalCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-option-group
。
- AWS CLI
-
若要刪除選項群組
下列
delete-option-group
範例會刪除指定的選項群組。aws rds delete-option-group \ --option-group-name
myoptiongroup
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的刪除選項群組。
-
如需API詳細資訊,請參閱 命令參考 DeleteOptionGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 deregister-db-proxy-targets
。
- AWS CLI
-
從資料庫目標群組取消註冊資料庫代理目標
下列
deregister-db-proxy-targets
範例會移除代理proxyExample
與其目標之間的關聯。aws rds deregister-db-proxy-targets \ --db-proxy-name
proxyExample
\ --db-instance-identifiersdatabase-1
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS使用者指南中的刪除RDS代理,以及 Amazon Aurora 使用者指南中的刪除RDS代理。
-
如需API詳細資訊,請參閱 命令參考 DeregisterDbProxyTargets
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-account-attributes
。
- AWS CLI
-
描述帳戶屬性
下列
describe-account-attributes
範例會擷取目前 AWS 帳戶的屬性。aws rds describe-account-attributes
輸出:
{ "AccountQuotas": [ { "Max": 40, "Used": 4, "AccountQuotaName": "DBInstances" }, { "Max": 40, "Used": 0, "AccountQuotaName": "ReservedDBInstances" }, { "Max": 100000, "Used": 40, "AccountQuotaName": "AllocatedStorage" }, { "Max": 25, "Used": 0, "AccountQuotaName": "DBSecurityGroups" }, { "Max": 20, "Used": 0, "AccountQuotaName": "AuthorizationsPerDBSecurityGroup" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBParameterGroups" }, { "Max": 100, "Used": 3, "AccountQuotaName": "ManualSnapshots" }, { "Max": 20, "Used": 0, "AccountQuotaName": "EventSubscriptions" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBSubnetGroups" }, { "Max": 20, "Used": 1, "AccountQuotaName": "OptionGroups" }, { "Max": 20, "Used": 6, "AccountQuotaName": "SubnetsPerDBSubnetGroup" }, { "Max": 5, "Used": 0, "AccountQuotaName": "ReadReplicasPerMaster" }, { "Max": 40, "Used": 1, "AccountQuotaName": "DBClusters" }, { "Max": 50, "Used": 0, "AccountQuotaName": "DBClusterParameterGroups" }, { "Max": 5, "Used": 0, "AccountQuotaName": "DBClusterRoles" } ] }
-
如需API詳細資訊,請參閱 命令參考 DescribeAccountAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-blue-green-deployments
。
- AWS CLI
-
範例 1:描述建立完成後RDS資料庫執行個體的藍/綠部署
下列
describe-blue-green-deployment
範例會在建立完成後擷取藍/綠部署的詳細資訊。aws rds describe-blue-green-deployments \ --blue-green-deployment-identifier
bgd-v53303651eexfake
輸出:
{ "BlueGreenDeployments": [ { "BlueGreenDeploymentIdentifier": "bgd-v53303651eexfake", "BlueGreenDeploymentName": "bgd-cli-test-instance", "Source": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "Target": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-rkfbpe", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-rkfbpe", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1-green-j382ha", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2-green-ejv4ao", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3-green-vlpz3t", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CONFIGURE_BACKUPS", "Status": "COMPLETED" }, { "Name": "CREATING_TOPOLOGY_OF_SOURCE", "Status": "COMPLETED" } ], "Status": "AVAILABLE", "CreateTime": "2022-02-25T21:18:51.183000+00:00" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的檢視藍/綠部署。
範例 2:描述 Aurora MySQL 資料庫叢集的藍/綠部署
下列
describe-blue-green-deployment
範例會擷取藍/綠部署的詳細資訊。aws rds describe-blue-green-deployments \ --blue-green-deployment-identifier
bgd-wi89nwzglccsfake
輸出:
{ "BlueGreenDeployments": [ { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzglccsfake", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Target": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1-green-gpmaxf", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2-green-j2oajq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3-green-mkxies", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint-green-4sqjrq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint-green-gwwzlg", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "COMPLETED" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "COMPLETED" } ], "Status": "AVAILABLE", "CreateTime": "2022-02-25T21:12:00.288000+00:00" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的檢視藍/綠部署。
範例 3:描述切換後 Aurora MySQL 叢集的藍/綠部署
下列
describe-blue-green-deployment
範例會在綠色環境提升為生產環境之後,擷取藍/綠部署的詳細資訊。aws rds describe-blue-green-deployments \ --blue-green-deployment-identifier
bgd-wi89nwzglccsfake
輸出:
{ "BlueGreenDeployments": [ { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzglccsfake", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-old1", "Target": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "Status": "SWITCHOVER_COMPLETED" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "COMPLETED" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "COMPLETED" } ], "Status": "SWITCHOVER_COMPLETED", "CreateTime": "2022-02-25T22:38:49.522000+00:00" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的檢視藍/綠部署。
範例 4:描述組合藍/綠部署
下列
describe-blue-green-deployment
範例會擷取組合藍/綠部署的詳細資訊。aws rds describe-blue-green-deployments
輸出:
{ "BlueGreenDeployments": [ { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzgfakelccs", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Target": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3rnukl", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1-green-gpmaxf", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2-green-j2oajq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3-green-mkxies", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint-green-4sqjrq", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint-green-gwwzlg", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "COMPLETED" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "COMPLETED" } ], "Status": "AVAILABLE", "CreateTime": "2022-02-25T21:12:00.288000+00:00" }, { "BlueGreenDeploymentIdentifier": "bgd-v5330365fake1eex", "BlueGreenDeploymentName": "bgd-cli-test-instance", "Source": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-old1", "Target": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2", "Status": "SWITCHOVER_COMPLETED" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3-old1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3", "Status": "SWITCHOVER_COMPLETED" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CONFIGURE_BACKUPS", "Status": "COMPLETED" }, { "Name": "CREATING_TOPOLOGY_OF_SOURCE", "Status": "COMPLETED" } ], "Status": "SWITCHOVER_COMPLETED", "CreateTime": "2022-02-25T22:33:22.225000+00:00" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的檢視藍/綠部署,以及 Amazon Aurora 使用者指南 中的檢視藍/綠部署。
-
如需API詳細資訊,請參閱 命令參考 DescribeBlueGreenDeployments
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-certificates
。
- AWS CLI
-
描述憑證
下列
describe-certificates
範例會擷取與使用者預設區域相關聯的憑證詳細資訊。aws rds describe-certificates
輸出:
{ "Certificates": [ { "CertificateIdentifier": "rds-ca-ecc384-g1", "CertificateType": "CA", "Thumbprint": "2ee3dcc06e50192559b13929e73484354f23387d", "ValidFrom": "2021-05-24T22:06:59+00:00", "ValidTill": "2121-05-24T23:06:59+00:00", "CertificateArn": "arn:aws:rds:us-west-2::cert:rds-ca-ecc384-g1", "CustomerOverride": false }, { "CertificateIdentifier": "rds-ca-rsa4096-g1", "CertificateType": "CA", "Thumbprint": "19da4f2af579a8ae1f6a0fa77aa5befd874b4cab", "ValidFrom": "2021-05-24T22:03:20+00:00", "ValidTill": "2121-05-24T23:03:20+00:00", "CertificateArn": "arn:aws:rds:us-west-2::cert:rds-ca-rsa4096-g1", "CustomerOverride": false }, { "CertificateIdentifier": "rds-ca-rsa2048-g1", "CertificateType": "CA", "Thumbprint": "7c40cb42714b6fdb2b296f9bbd0e8bb364436a76", "ValidFrom": "2021-05-24T21:59:00+00:00", "ValidTill": "2061-05-24T22:59:00+00:00", "CertificateArn": "arn:aws:rds:us-west-2::cert:rds-ca-rsa2048-g1", "CustomerOverride": true, "CustomerOverrideValidTill": "2061-05-24T22:59:00+00:00" }, { "CertificateIdentifier": "rds-ca-2019", "CertificateType": "CA", "Thumbprint": "d40ddb29e3750dffa671c3140bbf5f478d1c8096", "ValidFrom": "2019-08-22T17:08:50+00:00", "ValidTill": "2024-08-22T17:08:50+00:00", "CertificateArn": "arn:aws:rds:us-west-2::cert:rds-ca-2019", "CustomerOverride": false } ], "DefaultCertificateForNewLaunches": "rds-ca-rsa2048-g1" }
如需詳細資訊,請參閱Amazon 使用者指南中的使用 SSL/TLS 加密與資料庫執行個體的連線,以及 Amazon Aurora 使用者指南中的使用 SSL/TLS 加密與資料庫叢集的連線。 RDS
-
如需API詳細資訊,請參閱 命令參考 DescribeCertificates
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-backtracks
。
- AWS CLI
-
描述資料庫叢集的回溯
下列
describe-db-cluster-backtracks
範例會擷取指定資料庫叢集的詳細資訊。aws rds describe-db-cluster-backtracks \ --db-cluster-identifier
mydbcluster
輸出:
{ "DBClusterBacktracks": [ { "DBClusterIdentifier": "mydbcluster", "BacktrackIdentifier": "2f5f5294-0dd2-44c9-9f50-EXAMPLE", "BacktrackTo": "2021-02-12T04:59:22Z", "BacktrackedFrom": "2021-02-12T14:37:31.640Z", "BacktrackRequestCreationTime": "2021-02-12T14:36:18.819Z", "Status": "COMPLETED" }, { "DBClusterIdentifier": "mydbcluster", "BacktrackIdentifier": "3c7a6421-af2a-4ea3-ae95-EXAMPLE", "BacktrackTo": "2021-02-11T22:53:46Z", "BacktrackedFrom": "2021-02-12T00:09:27.006Z", "BacktrackRequestCreationTime": "2021-02-12T00:07:53.487Z", "Status": "COMPLETED" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的回溯 Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterBacktracks
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-endpoints
。
- AWS CLI
-
範例 1:描述資料庫叢集端點
下列
describe-db-cluster-endpoints
範例會擷取資料庫叢集端點的詳細資訊。最常見的 Aurora 叢集類型有兩個端點。一個端點具有類型WRITER
。您可以將此端點用於所有SQL陳述式。另一個端點具有類型READER
。您只能將此端點用於 SELECT和其他唯讀SQL陳述式。aws rds describe-db-cluster-endpoints
輸出:
{ "DBClusterEndpoints": [ { "DBClusterIdentifier": "my-database-1", "Endpoint": "my-database-1.cluster-cnpexample.us-east-1.rds.amazonaws.com", "Status": "creating", "EndpointType": "WRITER" }, { "DBClusterIdentifier": "my-database-1", "Endpoint": "my-database-1.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "Status": "creating", "EndpointType": "READER" }, { "DBClusterIdentifier": "mydbcluster", "Endpoint": "mydbcluster.cluster-cnpexamle.us-east-1.rds.amazonaws.com", "Status": "available", "EndpointType": "WRITER" }, { "DBClusterIdentifier": "mydbcluster", "Endpoint": "mydbcluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "Status": "available", "EndpointType": "READER" } ] }
範例 2:描述單一資料庫叢集的資料庫叢集端點
下列
describe-db-cluster-endpoints
範例會擷取單一指定資料庫叢集之資料庫叢集端點的詳細資訊。Aurora Serverless 叢集只有一種 類型的單一端點WRITER
。aws rds describe-db-cluster-endpoints \ --db-cluster-identifier
serverless-cluster
輸出:
{ "DBClusterEndpoints": [ { "Status": "available", "Endpoint": "serverless-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", "DBClusterIdentifier": "serverless-cluster", "EndpointType": "WRITER" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora Connection Management。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterEndpoints
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-parameter-groups
。
- AWS CLI
-
描述資料庫叢集參數群組
下列
describe-db-cluster-parameter-groups
範例會擷取資料庫叢集參數群組的詳細資訊。aws rds describe-db-cluster-parameter-groups
輸出:
{ "DBClusterParameterGroups": [ { "DBClusterParameterGroupName": "default.aurora-mysql5.7", "DBParameterGroupFamily": "aurora-mysql5.7", "Description": "Default cluster parameter group for aurora-mysql5.7", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:default.aurora-mysql5.7" }, { "DBClusterParameterGroupName": "default.aurora-postgresql9.6", "DBParameterGroupFamily": "aurora-postgresql9.6", "Description": "Default cluster parameter group for aurora-postgresql9.6", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:default.aurora-postgresql9.6" }, { "DBClusterParameterGroupName": "default.aurora5.6", "DBParameterGroupFamily": "aurora5.6", "Description": "Default cluster parameter group for aurora5.6", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:default.aurora5.6" }, { "DBClusterParameterGroupName": "mydbclusterpg", "DBParameterGroupFamily": "aurora-mysql5.7", "Description": "My DB cluster parameter group", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:mydbclusterpg" }, { "DBClusterParameterGroupName": "mydbclusterpgcopy", "DBParameterGroupFamily": "aurora-mysql5.7", "Description": "Copy of mydbclusterpg parameter group", "DBClusterParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:cluster-pg:mydbclusterpgcopy" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterParameterGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-parameters
。
- AWS CLI
-
範例 1:描述資料庫叢集參數群組中的參數
下列
describe-db-cluster-parameters
範例會擷取資料庫叢集參數群組中參數的詳細資訊。aws rds describe-db-cluster-parameters \ --db-cluster-parameter-group-name
mydbclusterpg
輸出:
{ "Parameters": [ { "ParameterName": "allow-suspicious-udfs", "Description": "Controls whether user-defined functions that have only an xxx symbol for the main function can be loaded", "Source": "engine-default", "ApplyType": "static", "DataType": "boolean", "AllowedValues": "0,1", "IsModifiable": false, "ApplyMethod": "pending-reboot", "SupportedEngineModes": [ "provisioned" ] }, { "ParameterName": "aurora_lab_mode", "ParameterValue": "0", "Description": "Enables new features in the Aurora engine.", "Source": "engine-default", "ApplyType": "static", "DataType": "boolean", "AllowedValues": "0,1", "IsModifiable": true, "ApplyMethod": "pending-reboot", "SupportedEngineModes": [ "provisioned" ] }, ...some output truncated... ] }
範例 2:僅列出資料庫叢集參數群組中的參數名稱
下列
describe-db-cluster-parameters
範例只會擷取資料庫叢集參數群組中參數的名稱。aws rds describe-db-cluster-parameters \ --db-cluster-parameter-group-name
default.aurora-mysql5.7
\ --query 'Parameters[].{ParameterName:ParameterName}
'輸出:
[ { "ParameterName": "allow-suspicious-udfs" }, { "ParameterName": "aurora_binlog_read_buffer_size" }, { "ParameterName": "aurora_binlog_replication_max_yield_seconds" }, { "ParameterName": "aurora_binlog_use_large_read_buffer" }, { "ParameterName": "aurora_lab_mode" }, ...some output truncated... } ]
範例 3:僅描述資料庫叢集參數群組中的可修改參數
下列
describe-db-cluster-parameters
範例只會擷取您可以在資料庫叢集參數群組中修改的參數名稱。aws rds describe-db-cluster-parameters \ --db-cluster-parameter-group-name
default.aurora-mysql5.7
\ --query 'Parameters[].{ParameterName:ParameterName,IsModifiable:IsModifiable} | [?IsModifiable == `true`]
'輸出:
[ { "ParameterName": "aurora_binlog_read_buffer_size", "IsModifiable": true }, { "ParameterName": "aurora_binlog_replication_max_yield_seconds", "IsModifiable": true }, { "ParameterName": "aurora_binlog_use_large_read_buffer", "IsModifiable": true }, { "ParameterName": "aurora_lab_mode", "IsModifiable": true }, ...some output truncated... } ]
範例 4:僅描述資料庫叢集參數群組中的可修改布林參數
下列
describe-db-cluster-parameters
範例只會擷取您可以在資料庫叢集參數群組中修改且具有布林資料類型的參數名稱。aws rds describe-db-cluster-parameters \ --db-cluster-parameter-group-name
default.aurora-mysql5.7
\ --query 'Parameters[].{ParameterName:ParameterName,DataType:DataType,IsModifiable:IsModifiable} | [?DataType == `boolean`] | [?IsModifiable == `true`]
'輸出:
[ { "DataType": "boolean", "ParameterName": "aurora_binlog_use_large_read_buffer", "IsModifiable": true }, { "DataType": "boolean", "ParameterName": "aurora_lab_mode", "IsModifiable": true }, { "DataType": "boolean", "ParameterName": "autocommit", "IsModifiable": true }, { "DataType": "boolean", "ParameterName": "automatic_sp_privileges", "IsModifiable": true }, ...some output truncated... } ]
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterParameters
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-snapshot-attributes
。
- AWS CLI
-
描述資料庫叢集快照的屬性名稱和值
下列
describe-db-cluster-snapshot-attributes
範例會擷取指定資料庫叢集快照之屬性名稱和值的詳細資訊。aws rds describe-db-cluster-snapshot-attributes \ --db-cluster-snapshot-identifier
myclustersnapshot
輸出:
{ "DBClusterSnapshotAttributesResult": { "DBClusterSnapshotIdentifier": "myclustersnapshot", "DBClusterSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "123456789012" ] } ] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的共用資料庫叢集快照。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterSnapshotAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-cluster-snapshots
。
- AWS CLI
-
描述資料庫叢集的資料庫叢集快照
下列
describe-db-cluster-snapshots
範例會擷取指定資料庫叢集之資料庫叢集快照的詳細資訊。aws rds describe-db-cluster-snapshots \ --db-cluster-identifier
mydbcluster
輸出:
{ "DBClusterSnapshots": [ { "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "DBClusterSnapshotIdentifier": "myclustersnapshotcopy", "DBClusterIdentifier": "mydbcluster", "SnapshotCreateTime": "2019-06-04T09:16:42.649Z", "Engine": "aurora-mysql", "AllocatedStorage": 0, "Status": "available", "Port": 0, "VpcId": "vpc-6594f31c", "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "MasterUsername": "myadmin", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LicenseModel": "aurora-mysql", "SnapshotType": "manual", "PercentProgress": 100, "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:814387698303:cluster-snapshot:myclustersnapshotcopy", "IAMDatabaseAuthenticationEnabled": false }, { "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "DBClusterSnapshotIdentifier": "rds:mydbcluster-2019-06-20-09-16", "DBClusterIdentifier": "mydbcluster", "SnapshotCreateTime": "2019-06-20T09:16:26.569Z", "Engine": "aurora-mysql", "AllocatedStorage": 0, "Status": "available", "Port": 0, "VpcId": "vpc-6594f31c", "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "MasterUsername": "myadmin", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LicenseModel": "aurora-mysql", "SnapshotType": "automated", "PercentProgress": 100, "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:814387698303:key/AKIAIOSFODNN7EXAMPLE", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:rds:mydbcluster-2019-06-20-09-16", "IAMDatabaseAuthenticationEnabled": false } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的建立資料庫叢集快照。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusterSnapshots
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-clusters
。
- AWS CLI
-
範例 1:描述資料庫叢集
下列
describe-db-clusters
範例會擷取指定資料庫叢集的詳細資訊。aws rds describe-db-clusters \ --db-cluster-identifier
mydbcluster
輸出:
{ "DBClusters": [ { "AllocatedStorage": 1, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1e" ], "BackupRetentionPeriod": 1, "DatabaseName": "mydbcluster", "DBClusterIdentifier": "mydbcluster", "DBClusterParameterGroup": "default.aurora-mysql5.7", "DBSubnetGroup": "default", "Status": "available", "EarliestRestorableTime": "2019-06-19T09:16:28.210Z", "Endpoint": "mydbcluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", "ReaderEndpoint": "mydbcluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "MultiAZ": true, "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.04.2", "LatestRestorableTime": "2019-06-20T22:38:14.908Z", "Port": 3306, "MasterUsername": "myadmin", "PreferredBackupWindow": "09:09-09:39", "PreferredMaintenanceWindow": "sat:04:09-sat:04:39", "ReadReplicaIdentifiers": [], "DBClusterMembers": [ { "DBInstanceIdentifier": "dbinstance3", "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 }, { "DBInstanceIdentifier": "dbinstance1", "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 }, { "DBInstanceIdentifier": "dbinstance2", "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 }, { "DBInstanceIdentifier": "mydbcluster", "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 }, { "DBInstanceIdentifier": "mydbcluster-us-east-1b", "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 }, { "DBInstanceIdentifier": "mydbcluster", "IsClusterWriter": true, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 } ], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-0b9130572daf3dc16", "Status": "active" } ], "HostedZoneId": "Z2R2ITUGPM61AM", "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-east-1:814387698303:key/AKIAIOSFODNN7EXAMPLE", "DbClusterResourceId": "cluster-AKIAIOSFODNN7EXAMPLE", "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "ClusterCreateTime": "2019-04-15T14:18:42.785Z", "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false } ] }
範例 2:列出所有資料庫叢集的特定屬性
下列
describe-db-clusters
範例只會擷取目前 AWS 區域中所有資料庫叢集的DBClusterIdentifier
Endpoint
、 和ReaderEndpoint
屬性。aws rds describe-db-clusters \ --query '
DBClusters[].{DBClusterIdentifier:DBClusterIdentifier,Endpoint:Endpoint,ReaderEndpoint:ReaderEndpoint}
'輸出:
[ { "Endpoint": "cluster-57-2020-05-01-2270.cluster-cnpexample.us-east-1.rds.amazonaws.com", "ReaderEndpoint": "cluster-57-2020-05-01-2270.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "DBClusterIdentifier": "cluster-57-2020-05-01-2270" }, { "Endpoint": "cluster-57-2020-05-01-4615.cluster-cnpexample.us-east-1.rds.amazonaws.com", "ReaderEndpoint": "cluster-57-2020-05-01-4615.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "DBClusterIdentifier": "cluster-57-2020-05-01-4615" }, { "Endpoint": "pg2-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", "ReaderEndpoint": "pg2-cluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", "DBClusterIdentifier": "pg2-cluster" }, ...output omitted... } ]
範例 3:列出具有特定屬性的資料庫叢集
下列
describe-db-clusters
範例只會擷取使用資料庫引擎之資料庫叢集的aurora-postgresql
DBClusterIdentifier
和Engine
屬性。aws rds describe-db-clusters \ --query '
DBClusters[].{DBClusterIdentifier:DBClusterIdentifier,Engine:Engine} | [?Engine == `aurora-postgresql`]
'輸出:
[ { "Engine": "aurora-postgresql", "DBClusterIdentifier": "pg2-cluster" } ]
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbClusters
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-engine-versions
。
- AWS CLI
-
描述 MySQL 資料庫引擎的資料庫引擎版本
下列
describe-db-engine-versions
範例顯示指定資料庫引擎的每個資料庫引擎版本的詳細資訊。aws rds describe-db-engine-versions \ --engine
mysql
輸出:
{ "DBEngineVersions": [ { "Engine": "mysql", "EngineVersion": "5.5.46", "DBParameterGroupFamily": "mysql5.5", "DBEngineDescription": "MySQL Community Edition", "DBEngineVersionDescription": "MySQL 5.5.46", "ValidUpgradeTarget": [ { "Engine": "mysql", "EngineVersion": "5.5.53", "Description": "MySQL 5.5.53", "AutoUpgrade": false, "IsMajorVersionUpgrade": false }, { "Engine": "mysql", "EngineVersion": "5.5.54", "Description": "MySQL 5.5.54", "AutoUpgrade": false, "IsMajorVersionUpgrade": false }, { "Engine": "mysql", "EngineVersion": "5.5.57", "Description": "MySQL 5.5.57", "AutoUpgrade": false, "IsMajorVersionUpgrade": false }, ...some output truncated... ] }
如需詳細資訊,請參閱 Amazon 使用者指南 中的什麼是 Amazon Relational Database Service (AmazonRDS)?。 RDS
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 D escribeDBEngine版本
。
-
下列程式碼範例示範如何使用 describe-db-instance-automated-backups
。
- AWS CLI
-
描述資料庫執行個體的自動備份
下列
describe-db-instance-automated-backups
範例顯示指定資料庫執行個體自動備份的詳細資訊。詳細資訊包括其他 AWS 區域中的複寫自動備份。aws rds describe-db-instance-automated-backups \ --db-instance-identifier
new-orcl-db
輸出:
{ "DBInstanceAutomatedBackups": [ { "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:new-orcl-db", "DbiResourceId": "db-JKIB2GFQ5RV7REPLZA4EXAMPLE", "Region": "us-east-1", "DBInstanceIdentifier": "new-orcl-db", "RestoreWindow": { "EarliestTime": "2020-12-07T21:05:20.939Z", "LatestTime": "2020-12-07T21:05:20.939Z" }, "AllocatedStorage": 20, "Status": "replicating", "Port": 1521, "InstanceCreateTime": "2020-12-04T15:28:31Z", "MasterUsername": "admin", "Engine": "oracle-se2", "EngineVersion": "12.1.0.2.v21", "LicenseModel": "bring-your-own-license", "OptionGroupName": "default:oracle-se2-12-1", "Encrypted": false, "StorageType": "gp2", "IAMDatabaseAuthenticationEnabled": false, "BackupRetentionPeriod": 14, "DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的尋找有關複寫備份的資訊。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbInstanceAutomatedBackups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-instances
。
- AWS CLI
-
描述資料庫執行個體
下列
describe-db-instances
範例會擷取指定資料庫執行個體的詳細資訊。aws rds describe-db-instances \ --db-instance-identifier
mydbinstancecf
輸出:
{ "DBInstances": [ { "DBInstanceIdentifier": "mydbinstancecf", "DBInstanceClass": "db.t3.small", "Engine": "mysql", "DBInstanceStatus": "available", "MasterUsername": "masterawsuser", "Endpoint": { "Address": "mydbinstancecf.abcexample.us-east-1.rds.amazonaws.com", "Port": 3306, "HostedZoneId": "Z2R2ITUGPM61AM" }, ...some output truncated... } ] }
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 DescribeDBInstances
。
-
下列程式碼範例示範如何使用 describe-db-log-files
。
- AWS CLI
-
描述資料庫執行個體的日誌檔案
下列
describe-db-log-files
範例會擷取指定資料庫執行個體的日誌檔案詳細資訊。aws rds describe
-
db-log-files -\-db-instance-identifier
test-instance
輸出:
{ "DescribeDBLogFiles": [ { "Size": 0, "LastWritten": 1533060000000, "LogFileName": "error/mysql-error-running.log" }, { "Size": 2683, "LastWritten": 1532994300000, "LogFileName": "error/mysql-error-running.log.0" }, { "Size": 107, "LastWritten": 1533057300000, "LogFileName": "error/mysql-error-running.log.18" }, { "Size": 13105, "LastWritten": 1532991000000, "LogFileName": "error/mysql-error-running.log.23" }, { "Size": 0, "LastWritten": 1533061200000, "LogFileName": "error/mysql-error.log" }, { "Size": 3519, "LastWritten": 1532989252000, "LogFileName": "mysqlUpgrade" } ] }
-
如需API詳細資訊,請參閱 命令參考 DescribeDbLogFiles
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-parameter-groups
。
- AWS CLI
-
描述資料庫參數群組
下列
describe-db-parameter-groups
範例會擷取資料庫參數群組的詳細資訊。aws rds describe-db-parameter-groups
輸出:
{ "DBParameterGroups": [ { "DBParameterGroupName": "default.aurora-mysql5.7", "DBParameterGroupFamily": "aurora-mysql5.7", "Description": "Default parameter group for aurora-mysql5.7", "DBParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:pg:default.aurora-mysql5.7" }, { "DBParameterGroupName": "default.aurora-postgresql9.6", "DBParameterGroupFamily": "aurora-postgresql9.6", "Description": "Default parameter group for aurora-postgresql9.6", "DBParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:pg:default.aurora-postgresql9.6" }, { "DBParameterGroupName": "default.aurora5.6", "DBParameterGroupFamily": "aurora5.6", "Description": "Default parameter group for aurora5.6", "DBParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:pg:default.aurora5.6" }, { "DBParameterGroupName": "default.mariadb10.1", "DBParameterGroupFamily": "mariadb10.1", "Description": "Default parameter group for mariadb10.1", "DBParameterGroupArn": "arn:aws:rds:us-east-1:123456789012:pg:default.mariadb10.1" }, ...some output truncated... ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用資料庫參數群組。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 D escribeDBParameter群組
。
-
下列程式碼範例示範如何使用 describe-db-parameters
。
- AWS CLI
-
描述資料庫參數群組中的參數
下列
describe-db-parameters
範例會擷取指定資料庫參數群組的詳細資訊。aws rds describe-db-parameters \ --db-parameter-group-name
mydbpg
輸出:
{ "Parameters": [ { "ParameterName": "allow-suspicious-udfs", "Description": "Controls whether user-defined functions that have only an xxx symbol for the main function can be loaded", "Source": "engine-default", "ApplyType": "static", "DataType": "boolean", "AllowedValues": "0,1", "IsModifiable": false, "ApplyMethod": "pending-reboot" }, { "ParameterName": "auto_generate_certs", "Description": "Controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist.", "Source": "engine-default", "ApplyType": "static", "DataType": "boolean", "AllowedValues": "0,1", "IsModifiable": false, "ApplyMethod": "pending-reboot" }, ...some output truncated... ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用資料庫參數群組。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 DescribeDBParameters
。
-
下列程式碼範例示範如何使用 describe-db-proxies
。
- AWS CLI
-
描述RDS資料庫的資料庫代理
下列
describe-db-proxies
範例會傳回資料庫代理的相關資訊。aws rds describe-db-proxies
輸出:
{ "DBProxies": [ { "DBProxyName": "proxyExample1", "DBProxyArn": "arn:aws:rds:us-east-1:123456789012:db-proxy:prx-0123a01b12345c0ab", "Status": "available", "EngineFamily": "PostgreSQL", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Auth": "[ { "Description": "proxydescription1" "AuthScheme": "SECRETS", "SecretArn": "arn:aws:secretsmanager:us-west-2:123456789123:secret:secretName-1234f", "IAMAuth": "DISABLED" } ]", "RoleArn": "arn:aws:iam::12345678912??:role/ProxyPostgreSQLRole", "Endpoint": "proxyExample1.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "RequireTLS": false, "IdleClientTimeout": 1800, "DebuggingLogging": false, "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "UpdatedDate": "2023-04-13T01:49:38.568000+00:00" }, { "DBProxyName": "proxyExample2", "DBProxyArn": "arn:aws:rds:us-east-1:123456789012:db-proxy:prx-1234a12b23456c1ab", "Status": "available", "EngineFamily": "PostgreSQL", "VpcId": "sg-1234567", "VpcSecurityGroupIds": [ "sg-1234" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Auth": "[ { "Description": "proxydescription2" "AuthScheme": "SECRETS", "SecretArn": "aarn:aws:secretsmanager:us-west-2:123456789123:secret:secretName-1234f", "IAMAuth": "DISABLED" } ]", "RoleArn": "arn:aws:iam::12345678912:role/ProxyPostgreSQLRole", "Endpoint": "proxyExample2.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "RequireTLS": false, "IdleClientTimeout": 1800, "DebuggingLogging": false, "CreatedDate": "2022-01-05T16:19:33.452000+00:00", "UpdatedDate": "2023-04-13T01:49:38.568000+00:00" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的檢視 RDS Proxy 和 Amazon Aurora 使用者指南中的檢視 RDS Proxy。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbProxies
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-proxy-endpoints
。
- AWS CLI
-
描述資料庫代理端點
下列
describe-db-proxy-endpoints
範例會傳回資料庫代理端點的相關資訊。aws rds describe-db-proxy-endpoints
輸出:
{ "DBProxyEndpoints": [ { "DBProxyEndpointName": "proxyEndpoint1", "DBProxyEndpointArn": "arn:aws:rds:us-east-1:123456789012:db-proxy-endpoint:prx-endpoint-0123a01b12345c0ab", "DBProxyName": "proxyExample", "Status": "available", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Endpoint": "proxyEndpoint1.endpoint.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "TargetRole": "READ_WRITE", "IsDefault": false }, { "DBProxyEndpointName": "proxyEndpoint2", "DBProxyEndpointArn": "arn:aws:rds:us-east-1:123456789012:db-proxy-endpoint:prx-endpoint-4567a01b12345c0ab", "DBProxyName": "proxyExample2", "Status": "available", "VpcId": "vpc1234567", "VpcSecurityGroupIds": [ "sg-5678" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Endpoint": "proxyEndpoint2.endpoint.proxy-cd1ef2klmnop.us-east-1.rds.amazonaws.com", "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "TargetRole": "READ_WRITE", "IsDefault": false } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的檢視代理端點和 Amazon Aurora 使用者指南中的建立代理端點。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbProxyEndpoints
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-proxy-target-groups
。
- AWS CLI
-
描述資料庫代理端點
下列
describe-db-proxy-target-groups
範例會傳回資料庫代理目標群組的相關資訊。aws rds describe-db-proxy-target-groups \ --db-proxy-name
proxyExample
輸出:
{ "TargetGroups": { "DBProxyName": "proxyExample", "TargetGroupName": "default", "TargetGroupArn": "arn:aws:rds:us-east-1:123456789012:target-group:prx-tg-0123a01b12345c0ab", "IsDefault": true, "Status": "available", "ConnectionPoolConfig": { "MaxConnectionsPercent": 100, "MaxIdleConnectionsPercent": 50, "ConnectionBorrowTimeout": 120, "SessionPinningFilters": [] }, "CreatedDate": "2023-05-02T18:41:19.495000+00:00", "UpdatedDate": "2023-05-02T18:41:21.762000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的檢視 RDS Proxy 和 Amazon Aurora 使用者指南中的檢視 RDS Proxy。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbProxyTargetGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-proxy-targets
。
- AWS CLI
-
描述資料庫代理目標
下列
describe-db-proxy-targets
範例會傳回資料庫代理目標的相關資訊。aws rds describe-db-proxy-targets \ --db-proxy-name
proxyExample
輸出:
{ "Targets": [ { "Endpoint": "database1.ab0cd1efghij.us-east-1.rds.amazonaws.com", "TrackedClusterId": "database1", "RdsResourceId": "database1-instance-1", "Port": 3306, "Type": "RDS_INSTANCE", "Role": "READ_WRITE", "TargetHealth": { "State": "UNAVAILABLE", "Reason": "PENDING_PROXY_CAPACITY", "Description": "DBProxy Target is waiting for proxy to scale to desired capacity" } } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的檢視RDS代理,以及 Amazon Aurora 使用者指南中的檢視RDS代理。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbProxyTargets
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-recommendations
。
- AWS CLI
-
範例 1:列出所有資料庫建議
下列
describe-db-recommendations
範例列出您 AWS 帳戶中的所有資料庫建議。aws rds describe-db-recommendations
輸出:
{ "DBRecommendations": [ { "RecommendationId": "12ab3cde-f456-7g8h-9012-i3j45678k9lm", "TypeId": "config_recommendation::old_minor_version", "Severity": "informational", "ResourceArn": "arn:aws:rds:us-west-2:111122223333:db:database-1", "Status": "active", "CreatedTime": "2024-02-21T23:14:19.292000+00:00", "UpdatedTime": "2024-02-21T23:14:19+00:00", "Detection": "**[resource-name]** is not running the latest minor DB engine version", "Recommendation": "Upgrade to latest engine version", "Description": "Your database resources aren't running the latest minor DB engine version. The latest minor version contains the latest security fixes and other improvements.", "RecommendedActions": [ { "ActionId": "12ab34c5de6fg7h89i0jk1lm234n5678", "Operation": "modifyDbInstance", "Parameters": [ { "Key": "EngineVersion", "Value": "5.7.44" }, { "Key": "DBInstanceIdentifier", "Value": "database-1" } ], "ApplyModes": [ "immediately", "next-maintenance-window" ], "Status": "ready", "ContextAttributes": [ { "Key": "Recommended value", "Value": "5.7.44" }, { "Key": "Current engine version", "Value": "5.7.42" } ] } ], "Category": "security", "Source": "RDS", "TypeDetection": "**[resource-count] resources** are not running the latest minor DB engine version", "TypeRecommendation": "Upgrade to latest engine version", "Impact": "Reduced database performance and data security at risk", "AdditionalInfo": "We recommend that you maintain your database with the latest DB engine minor version as this version includes the latest security and functionality fixes. The DB engine minor version upgrades contain only the changes which are backward-compatible with earlier minor versions of the same major version of the DB engine.", "Links": [ { "Text": "Upgrading an RDS DB instance engine version", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Upgrading.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon Aurora", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon RDS", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html" } ] } ] }
如需詳細資訊,請參閱 Amazon 使用者指南中的檢視和回應 Amazon RDS建議,以及 Amazon Aurora 使用者指南 中的檢視和回應 Amazon RDS建議。 RDS
範例 2:列出高嚴重性的資料庫建議
下列
describe-db-recommendations
範例列出您 AWS 帳戶中的高嚴重性資料庫建議。aws rds describe-db-recommendations \ --filters
Name=severity,Values=high
輸出:
{ "DBRecommendations": [ { "RecommendationId": "12ab3cde-f456-7g8h-9012-i3j45678k9lm", "TypeId": "config_recommendation::rds_extended_support", "Severity": "high", "ResourceArn": "arn:aws:rds:us-west-2:111122223333:db:database-1", "Status": "active", "CreatedTime": "2024-02-21T23:14:19.392000+00:00", "UpdatedTime": "2024-02-21T23:14:19+00:00", "Detection": "Your databases will be auto-enrolled to RDS Extended Support on February 29", "Recommendation": "Upgrade your major version before February 29, 2024 to avoid additional charges", "Description": "Your PostgreSQL 11 and MySQL 5.7 databases will be automatically enrolled into RDS Extended Support on February 29, 2024. To avoid the increase in charges due to RDS Extended Support, we recommend upgrading your databases to a newer major engine version before February 29, 2024.\nTo learn more about the RDS Extended Support pricing, refer to the pricing page.", "RecommendedActions": [ { "ActionId": "12ab34c5de6fg7h89i0jk1lm234n5678", "Parameters": [], "ApplyModes": [ "manual" ], "Status": "ready", "ContextAttributes": [] } ], "Category": "cost optimization", "Source": "RDS", "TypeDetection": "Your database will be auto-enrolled to RDS Extended Support on February 29", "TypeRecommendation": "Upgrade your major version before February 29, 2024 to avoid additional charges", "Impact": "Increase in charges due to RDS Extended Support", "AdditionalInfo": "With Amazon RDS Extended Support, you can continue running your database on a major engine version past the RDS end of standard support date for an additional cost. This paid feature gives you more time to upgrade to a supported major engine version.\nDuring Extended Support, Amazon RDS will supply critical CVE patches and bug fixes.", "Links": [ { "Text": "Amazon RDS Extended Support pricing for RDS for MySQL", "Url": "https://aws.amazon.com/rds/mysql/pricing/" }, { "Text": "Amazon RDS Extended Support for RDS for MySQL and PostgreSQL databases", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/extended-support.html" }, { "Text": "Amazon RDS Extended Support pricing for Amazon Aurora PostgreSQL", "Url": "https://aws.amazon.com/rds/aurora/pricing/" }, { "Text": "Amazon RDS Extended Support for Aurora PostgreSQL databases", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/extended-support.html" }, { "Text": "Amazon RDS Extended Support pricing for RDS for PostgreSQL", "Url": "https://aws.amazon.com/rds/postgresql/pricing/" } ] } ] }
如需詳細資訊,請參閱 Amazon 使用者指南中的檢視和回應 Amazon RDS建議,以及 Amazon Aurora 使用者指南 中的檢視和回應 Amazon RDS建議。 RDS
範例 3:列出指定資料庫執行個體的資料庫建議
下列
describe-db-recommendations
範例會列出指定資料庫執行個體的所有資料庫建議。aws rds describe-db-recommendations \ --filters
Name=dbi-resource-id,Values=database-1
輸出:
{ "DBRecommendations": [ { "RecommendationId": "12ab3cde-f456-7g8h-9012-i3j45678k9lm", "TypeId": "config_recommendation::old_minor_version", "Severity": "informational", "ResourceArn": "arn:aws:rds:us-west-2:111122223333:db:database-1", "Status": "active", "CreatedTime": "2024-02-21T23:14:19.292000+00:00", "UpdatedTime": "2024-02-21T23:14:19+00:00", "Detection": "**[resource-name]** is not running the latest minor DB engine version", "Recommendation": "Upgrade to latest engine version", "Description": "Your database resources aren't running the latest minor DB engine version. The latest minor version contains the latest security fixes and other improvements.", "RecommendedActions": [ { "ActionId": "12ab34c5de6fg7h89i0jk1lm234n5678", "Operation": "modifyDbInstance", "Parameters": [ { "Key": "EngineVersion", "Value": "5.7.44" }, { "Key": "DBInstanceIdentifier", "Value": "database-1" } ], "ApplyModes": [ "immediately", "next-maintenance-window" ], "Status": "ready", "ContextAttributes": [ { "Key": "Recommended value", "Value": "5.7.44" }, { "Key": "Current engine version", "Value": "5.7.42" } ] } ], "Category": "security", "Source": "RDS", "TypeDetection": "**[resource-count] resources** are not running the latest minor DB engine version", "TypeRecommendation": "Upgrade to latest engine version", "Impact": "Reduced database performance and data security at risk", "AdditionalInfo": "We recommend that you maintain your database with the latest DB engine minor version as this version includes the latest security and functionality fixes. The DB engine minor version upgrades contain only the changes which are backward-compatible with earlier minor versions of the same major version of the DB engine.", "Links": [ { "Text": "Upgrading an RDS DB instance engine version", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Upgrading.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon Aurora", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon RDS", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html" } ] } ] }
如需詳細資訊,請參閱 Amazon 使用者指南中的檢視和回應 Amazon RDS建議,以及 Amazon Aurora 使用者指南 中的檢視和回應 Amazon RDS建議。 RDS
範例 4:列出所有作用中資料庫建議
下列
describe-db-recommendations
範例列出您 AWS 帳戶中所有作用中資料庫建議。aws rds describe-db-recommendations \ --filters
Name=status,Values=active
輸出:
{ "DBRecommendations": [ { "RecommendationId": "12ab3cde-f456-7g8h-9012-i3j45678k9lm", "TypeId": "config_recommendation::old_minor_version", "Severity": "informational", "ResourceArn": "arn:aws:rds:us-west-2:111122223333:db:database-1", "Status": "active", "CreatedTime": "2024-02-21T23:14:19.292000+00:00", "UpdatedTime": "2024-02-21T23:14:19+00:00", "Detection": "**[resource-name]** is not running the latest minor DB engine version", "Recommendation": "Upgrade to latest engine version", "Description": "Your database resources aren't running the latest minor DB engine version. The latest minor version contains the latest security fixes and other improvements.", "RecommendedActions": [ { "ActionId": "12ab34c5de6fg7h89i0jk1lm234n5678", "Operation": "modifyDbInstance", "Parameters": [ { "Key": "EngineVersion", "Value": "5.7.44" }, { "Key": "DBInstanceIdentifier", "Value": "database-1" } ], "ApplyModes": [ "immediately", "next-maintenance-window" ], "Status": "ready", "ContextAttributes": [ { "Key": "Recommended value", "Value": "5.7.44" }, { "Key": "Current engine version", "Value": "5.7.42" } ] } ], "Category": "security", "Source": "RDS", "TypeDetection": "**[resource-count] resources** are not running the latest minor DB engine version", "TypeRecommendation": "Upgrade to latest engine version", "Impact": "Reduced database performance and data security at risk", "AdditionalInfo": "We recommend that you maintain your database with the latest DB engine minor version as this version includes the latest security and functionality fixes. The DB engine minor version upgrades contain only the changes which are backward-compatible with earlier minor versions of the same major version of the DB engine.", "Links": [ { "Text": "Upgrading an RDS DB instance engine version", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Upgrading.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon Aurora", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html" }, { "Text": "Using Amazon RDS Blue/Green Deployments for database updates for Amazon RDS", "Url": "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html" } ] } ] }
如需詳細資訊,請參閱 Amazon 使用者指南中的檢視和回應 Amazon RDS建議,以及 Amazon Aurora 使用者指南 中的檢視和回應 Amazon RDS建議。 RDS
-
如需API詳細資訊,請參閱 命令參考 DescribeDbRecommendations
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-security-groups
。
- AWS CLI
-
列出資料庫安全群組
下列
describe-db-security-groups
範例列出資料庫安全群組。aws rds describe-db-security-groups
輸出:
{ "DBSecurityGroups": [ { "OwnerId": "123456789012", "DBSecurityGroupName": "default", "DBSecurityGroupDescription": "default", "EC2SecurityGroups": [], "IPRanges": [], "DBSecurityGroupArn": "arn:aws:rds:us-west-1:111122223333:secgrp:default" }, { "OwnerId": "123456789012", "DBSecurityGroupName": "mysecgroup", "DBSecurityGroupDescription": "My Test Security Group", "VpcId": "vpc-1234567f", "EC2SecurityGroups": [], "IPRanges": [], "DBSecurityGroupArn": "arn:aws:rds:us-west-1:111122223333:secgrp:mysecgroup" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的列出可用的資料庫安全群組。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbSecurityGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-shard-groups
。
- AWS CLI
-
範例 1:描述資料庫碎片群組
下列
describe-db-shard-groups
範例會擷取資料庫碎片群組的詳細資訊。aws rds describe-db-shard-groups
輸出:
{ "DBShardGroups": [ { "DBShardGroupResourceId": "shardgroup-7bb446329da94788b3f957746example", "DBShardGroupIdentifier": "limitless-test-shard-grp", "DBClusterIdentifier": "limitless-test-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": true, "Endpoint": "limitless-test-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" }, { "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbShardGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-snapshot-attributes
。
- AWS CLI
-
描述資料庫快照的屬性名稱和值
下列
describe-db-snapshot-attributes
範例說明資料庫快照的屬性名稱和值。aws rds describe-db-snapshot-attributes \ --db-snapshot-identifier
mydbsnapshot
輸出:
{ "DBSnapshotAttributesResult": { "DBSnapshotIdentifier": "mydbsnapshot", "DBSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "123456789012", "210987654321" ] } ] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的共用資料庫快照。
-
如需API詳細資訊,請參閱 命令參考 DescribeDbSnapshotAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-db-snapshots
。
- AWS CLI
-
範例 1:描述資料庫執行個體的資料庫快照
下列
describe-db-snapshots
範例會擷取資料庫執行個體的資料庫快照詳細資訊。aws rds describe-db-snapshots \ --db-snapshot-identifier
mydbsnapshot
輸出:
{ "DBSnapshots": [ { "DBSnapshotIdentifier": "mydbsnapshot", "DBInstanceIdentifier": "mysqldb", "SnapshotCreateTime": "2018-02-08T22:28:08.598Z", "Engine": "mysql", "AllocatedStorage": 20, "Status": "available", "Port": 3306, "AvailabilityZone": "us-east-1f", "VpcId": "vpc-6594f31c", "InstanceCreateTime": "2018-02-08T22:24:55.973Z", "MasterUsername": "mysqladmin", "EngineVersion": "5.6.37", "LicenseModel": "general-public-license", "SnapshotType": "manual", "OptionGroupName": "default:mysql-5-6", "PercentProgress": 100, "StorageType": "gp2", "Encrypted": false, "DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mydbsnapshot", "IAMDatabaseAuthenticationEnabled": false, "ProcessorFeatures": [], "DbiResourceId": "db-AKIAIOSFODNN7EXAMPLE" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的建立資料庫快照。
範例 2:尋找所拍攝的手動快照數量
下列
describe-db-snapshots
範例使用--query
選項中的length
運算子來傳回在特定 AWS 區域中已拍攝的手動快照數量。aws rds describe-db-snapshots \ --snapshot-type
manual
\ --query"length(*[].{DBSnapshots:SnapshotType})"
\ --regioneu-central-1
輸出:
35
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的建立資料庫快照。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 DescribeDBSnapshots
。
-
下列程式碼範例示範如何使用 describe-db-subnet-groups
。
- AWS CLI
-
描述資料庫子網路群組
下列
describe-db-subnet-groups
範例會擷取指定資料庫子網路群組的詳細資訊。aws rds describe-db-subnet-groups
輸出:
{ "DBSubnetGroups": [ { "DBSubnetGroupName": "mydbsubnetgroup", "DBSubnetGroupDescription": "My DB Subnet Group", "VpcId": "vpc-971c12ee", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-d8c8e7f4", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-718fdc7d", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbc8e7e7", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-0ccde220", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" } ], "DBSubnetGroupArn": "arn:aws:rds:us-east-1:123456789012:subgrp:mydbsubnetgroup" } ] }
如需詳細資訊,請參閱 Amazon 使用者指南 中的 Amazon Virtual Private Cloud VPCs和 AmazonRDS。 RDS
-
如需API詳細資訊,請參閱 命令參考 DescribeDbSubnetGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-engine-default-cluster-parameters
。
- AWS CLI
-
描述 Aurora 資料庫引擎的預設引擎和系統參數資訊
下列
describe-engine-default-cluster-parameters
範例會擷取具有 MySQL 5.7 相容性的 Aurora 資料庫叢集的預設引擎和系統參數資訊的詳細資訊。aws rds describe-engine-default-cluster-parameters \ --db-parameter-group-family
aurora-mysql5.7
輸出:
{ "EngineDefaults": { "Parameters": [ { "ParameterName": "aurora_load_from_s3_role", "Description": "IAM role ARN used to load data from AWS S3", "Source": "engine-default", "ApplyType": "dynamic", "DataType": "string", "IsModifiable": true, "SupportedEngineModes": [ "provisioned" ] }, ...some output truncated... ] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 DescribeEngineDefaultClusterParameters
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-engine-default-parameters
。
- AWS CLI
-
描述資料庫引擎的預設引擎和系統參數資訊
下列
describe-engine-default-parameters
範例會擷取 MySQL 5.7 資料庫執行個體的預設引擎和系統參數資訊的詳細資訊。aws rds describe-engine-default-parameters \ --db-parameter-group-family
mysql5.7
輸出:
{ "EngineDefaults": { "Parameters": [ { "ParameterName": "allow-suspicious-udfs", "Description": "Controls whether user-defined functions that have only an xxx symbol for the main function can be loaded", "Source": "engine-default", "ApplyType": "static", "DataType": "boolean", "AllowedValues": "0,1", "IsModifiable": false }, ...some output truncated... ] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用資料庫參數群組。
-
如需API詳細資訊,請參閱 命令參考 DescribeEngineDefaultParameters
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-event-categories
。
- AWS CLI
-
描述事件類別
下列
describe-event-categories
範例會擷取所有可用事件來源的事件類別詳細資訊。aws rds describe-event-categories
輸出:
{ "EventCategoriesMapList": [ { "SourceType": "db-instance", "EventCategories": [ "deletion", "read replica", "failover", "restoration", "maintenance", "low storage", "configuration change", "backup", "creation", "availability", "recovery", "failure", "backtrack", "notification" ] }, { "SourceType": "db-security-group", "EventCategories": [ "configuration change", "failure" ] }, { "SourceType": "db-parameter-group", "EventCategories": [ "configuration change" ] }, { "SourceType": "db-snapshot", "EventCategories": [ "deletion", "creation", "restoration", "notification" ] }, { "SourceType": "db-cluster", "EventCategories": [ "failover", "failure", "notification" ] }, { "SourceType": "db-cluster-snapshot", "EventCategories": [ "backup" ] } ] }
-
如需API詳細資訊,請參閱 命令參考 DescribeEventCategories
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-event-subscriptions
。
- AWS CLI
-
描述事件訂閱
此範例說明目前 AWS 帳戶的所有 Amazon RDS事件訂閱。
aws rds describe-event-subscriptions
輸出:
{ "EventSubscriptionsList": [ { "EventCategoriesList": [ "backup", "recovery" ], "Enabled": true, "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "Status": "creating", "SourceType": "db-instance", "CustomerAwsId": "123456789012", "SubscriptionCreationTime": "2018-07-31 23:22:01.893", "CustSubscriptionId": "my-instance-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events" }, ...some output truncated... ] }
-
如需API詳細資訊,請參閱 命令參考 DescribeEventSubscriptions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-events
。
- AWS CLI
-
描述事件
下列
describe-events
範例會擷取指定資料庫執行個體所發生事件的詳細資訊。aws rds describe-events \ --source-identifier
test-instance
\ --source-typedb-instance
輸出:
{ "Events": [ { "SourceType": "db-instance", "SourceIdentifier": "test-instance", "EventCategories": [ "backup" ], "Message": "Backing up DB instance", "Date": "2018-07-31T23:09:23.983Z", "SourceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance" }, { "SourceType": "db-instance", "SourceIdentifier": "test-instance", "EventCategories": [ "backup" ], "Message": "Finished DB Instance backup", "Date": "2018-07-31T23:15:13.049Z", "SourceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance" } ] }
-
如需API詳細資訊,請參閱 命令參考 DescribeEvents
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-export-tasks
。
- AWS CLI
-
描述快照匯出任務
下列
describe-export-tasks
範例會傳回快照匯出至 Amazon S3 的相關資訊。aws rds describe-export-tasks
輸出:
{ "ExportTasks": [ { "ExportTaskIdentifier": "test-snapshot-export", "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:test-snapshot", "SnapshotTime": "2020-03-02T18:26:28.163Z", "TaskStartTime": "2020-03-02T18:57:56.896Z", "TaskEndTime": "2020-03-02T19:10:31.985Z", "S3Bucket": "mybucket", "S3Prefix": "", "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", "Status": "COMPLETE", "PercentProgress": 100, "TotalExtractedDataInGB": 0 }, { "ExportTaskIdentifier": "my-s3-export", "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test", "SnapshotTime": "2020-03-27T20:48:42.023Z", "S3Bucket": "mybucket", "S3Prefix": "", "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", "Status": "STARTING", "PercentProgress": 0, "TotalExtractedDataInGB": 0 } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的監控快照匯出。
-
如需API詳細資訊,請參閱 命令參考 DescribeExportTasks
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-global-clusters
。
- AWS CLI
-
描述全域資料庫叢集
下列
describe-global-clusters
範例列出目前 AWS 區域中的 Aurora 全域資料庫叢集。aws rds describe-global-clusters
輸出:
{ "GlobalClusters": [ { "GlobalClusterIdentifier": "myglobalcluster", "GlobalClusterResourceId": "cluster-f5982077e3b5aabb", "GlobalClusterArn": "arn:aws:rds::123456789012:global-cluster:myglobalcluster", "Status": "available", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.07.2", "StorageEncrypted": false, "DeletionProtection": false, "GlobalClusterMembers": [] } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的管理 Aurora 全域資料庫。
-
如需API詳細資訊,請參閱 命令參考 DescribeGlobalClusters
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-option-group-options
。
- AWS CLI
-
描述所有可用的選項
下列
describe-option-group-options
範例列出 Oracle Database 19c 執行個體的兩個選項。aws rds describe-option-group-options \ --engine-name
oracle-ee
\ --major-engine-version19
\ --max-items2
輸出:
{ "OptionGroupOptions": [ { "Name": "APEX", "Description": "Oracle Application Express Runtime Environment", "EngineName": "oracle-ee", "MajorEngineVersion": "19", "MinimumRequiredMinorEngineVersion": "0.0.0.ru-2019-07.rur-2019-07.r1", "PortRequired": false, "OptionsDependedOn": [], "OptionsConflictsWith": [], "Persistent": false, "Permanent": false, "RequiresAutoMinorEngineVersionUpgrade": false, "VpcOnly": false, "SupportsOptionVersionDowngrade": false, "OptionGroupOptionSettings": [], "OptionGroupOptionVersions": [ { "Version": "19.1.v1", "IsDefault": true }, { "Version": "19.2.v1", "IsDefault": false } ] }, { "Name": "APEX-DEV", "Description": "Oracle Application Express Development Environment", "EngineName": "oracle-ee", "MajorEngineVersion": "19", "MinimumRequiredMinorEngineVersion": "0.0.0.ru-2019-07.rur-2019-07.r1", "PortRequired": false, "OptionsDependedOn": [ "APEX" ], "OptionsConflictsWith": [], "Persistent": false, "Permanent": false, "RequiresAutoMinorEngineVersionUpgrade": false, "VpcOnly": false, "OptionGroupOptionSettings": [] } ], "NextToken": "eyJNYXJrZXIiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的列出選項群組的選項和選項設定。
-
如需API詳細資訊,請參閱 命令參考 DescribeOptionGroupOptions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-option-groups
。
- AWS CLI
-
描述可用的選項群組
下列
describe-option-groups
範例列出 Oracle Database 19c 執行個體的選項群組。aws rds describe-option-groups \ --engine-name
oracle-ee
\ --major-engine-version19
輸出:
{ "OptionGroupsList": [ { "OptionGroupName": "default:oracle-ee-19", "OptionGroupDescription": "Default option group for oracle-ee 19", "EngineName": "oracle-ee", "MajorEngineVersion": "19", "Options": [], "AllowsVpcAndNonVpcInstanceMemberships": true, "OptionGroupArn": "arn:aws:rds:us-west-1:111122223333:og:default:oracle-ee-19" } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的列出選項群組的選項和選項設定。
-
如需API詳細資訊,請參閱 命令參考 DescribeOptionGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-orderable-db-instance-options
。
- AWS CLI
-
描述可排序的資料庫執行個體選項
下列
describe-orderable-db-instance-options
範例會擷取執行 MySQL 資料庫引擎之資料庫執行個體的可排序選項詳細資訊。aws rds describe-orderable-db-instance-options \ --engine
mysql
輸出:
{ "OrderableDBInstanceOptions": [ { "MinStorageSize": 5, "ReadReplicaCapable": true, "MaxStorageSize": 6144, "AvailabilityZones": [ { "Name": "us-east-1a" }, { "Name": "us-east-1b" }, { "Name": "us-east-1c" }, { "Name": "us-east-1d" } ], "SupportsIops": false, "AvailableProcessorFeatures": [], "MultiAZCapable": true, "DBInstanceClass": "db.m1.large", "Vpc": true, "StorageType": "gp2", "LicenseModel": "general-public-license", "EngineVersion": "5.5.46", "SupportsStorageEncryption": false, "SupportsEnhancedMonitoring": true, "Engine": "mysql", "SupportsIAMDatabaseAuthentication": false, "SupportsPerformanceInsights": false } ] ...some output truncated... }
-
如需API詳細資訊,請參閱 命令參考 DescribeOrderableDBInstanceOptions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-pending-maintenance-actions
。
- AWS CLI
-
列出至少有一個待定維護動作的資源
下列
describe-pending-maintenance-actions
範例列出資料庫執行個體的待處理維護動作。aws rds describe-pending-maintenance-actions
輸出:
{ "PendingMaintenanceActions": [ { "ResourceIdentifier": "arn:aws:rds:us-west-2:123456789012:cluster:global-db1-cl1", "PendingMaintenanceActionDetails": [ { "Action": "system-update", "Description": "Upgrade to Aurora PostgreSQL 2.4.2" } ] } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的維護資料庫執行個體。
-
如需API詳細資訊,請參閱 命令參考 DescribePendingMaintenanceActions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-reserved-db-instances-offerings
。
- AWS CLI
-
描述預留資料庫執行個體方案
下列
describe-reserved-db-instances-offerings
範例會擷取 預留資料庫執行個體選項的詳細資訊oracle
。aws rds describe-reserved-db-instances-offerings \ --product-description
oracle
輸出:
{ "ReservedDBInstancesOfferings": [ { "CurrencyCode": "USD", "UsagePrice": 0.0, "ProductDescription": "oracle-se2(li)", "ReservedDBInstancesOfferingId": "005bdee3-9ef4-4182-aa0c-58ef7cb6c2f8", "MultiAZ": true, "DBInstanceClass": "db.m4.xlarge", "OfferingType": "Partial Upfront", "RecurringCharges": [ { "RecurringChargeAmount": 0.594, "RecurringChargeFrequency": "Hourly" } ], "FixedPrice": 4089.0, "Duration": 31536000 }, ...some output truncated... }
-
如需API詳細資訊,請參閱 命令參考 DescribeReservedDbInstancesOfferings
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-reserved-db-instances
。
- AWS CLI
-
描述預留資料庫執行個體
下列
describe-reserved-db-instances
範例會擷取目前 AWS 帳戶中任何預留資料庫執行個體的詳細資訊。aws rds describe-reserved-db-instances
輸出:
{ "ReservedDBInstances": [ { "ReservedDBInstanceId": "myreservedinstance", "ReservedDBInstancesOfferingId": "12ab34cd-59af-4b2c-a660-1abcdef23456", "DBInstanceClass": "db.t3.micro", "StartTime": "2020-06-01T13:44:21.436Z", "Duration": 31536000, "FixedPrice": 0.0, "UsagePrice": 0.0, "CurrencyCode": "USD", "DBInstanceCount": 1, "ProductDescription": "sqlserver-ex(li)", "OfferingType": "No Upfront", "MultiAZ": false, "State": "payment-pending", "RecurringCharges": [ { "RecurringChargeAmount": 0.014, "RecurringChargeFrequency": "Hourly" } ], "ReservedDBInstanceArn": "arn:aws:rds:us-west-2:123456789012:ri:myreservedinstance", "LeaseId": "a1b2c3d4-6b69-4a59-be89-5e11aa446666" } ] }
如需詳細資訊,請參閱 Amazon 使用者指南 中的 Amazon 預留資料庫執行個體RDS。 RDS
-
如需API詳細資訊,請參閱 命令參考 DescribeReservedDbInstances
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-source-regions
。
- AWS CLI
-
描述來源區域
下列
describe-source-regions
範例會擷取所有來源 AWS 區域的詳細資訊。它還顯示,自動化備份只能從美國西部 (奧勒岡) 複寫到目的地 AWS 區域美國東部 (維吉尼亞北部)。aws rds describe-source-regions \ --region
us-east-1
輸出:
{ "SourceRegions": [ { "RegionName": "af-south-1", "Endpoint": "https://rds.af-south-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "ap-east-1", "Endpoint": "https://rds.ap-east-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "ap-northeast-1", "Endpoint": "https://rds.ap-northeast-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "ap-northeast-2", "Endpoint": "https://rds.ap-northeast-2.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "ap-northeast-3", "Endpoint": "https://rds.ap-northeast-3.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "ap-south-1", "Endpoint": "https://rds.ap-south-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "ap-southeast-1", "Endpoint": "https://rds.ap-southeast-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "ap-southeast-2", "Endpoint": "https://rds.ap-southeast-2.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "ap-southeast-3", "Endpoint": "https://rds.ap-southeast-3.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "ca-central-1", "Endpoint": "https://rds.ca-central-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "eu-north-1", "Endpoint": "https://rds.eu-north-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "eu-south-1", "Endpoint": "https://rds.eu-south-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "eu-west-1", "Endpoint": "https://rds.eu-west-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "eu-west-2", "Endpoint": "https://rds.eu-west-2.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "eu-west-3", "Endpoint": "https://rds.eu-west-3.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "me-central-1", "Endpoint": "https://rds.me-central-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "me-south-1", "Endpoint": "https://rds.me-south-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": false }, { "RegionName": "sa-east-1", "Endpoint": "https://rds.sa-east-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "us-east-2", "Endpoint": "https://rds.us-east-2.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "us-west-1", "Endpoint": "https://rds.us-west-1.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true }, { "RegionName": "us-west-2", "Endpoint": "https://rds.us-west-2.amazonaws.com", "Status": "available", "SupportsDBInstanceAutomatedBackupsReplication": true } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的尋找有關複寫備份的資訊。
-
如需API詳細資訊,請參閱 命令參考 DescribeSourceRegions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-valid-db-instance-modifications
。
- AWS CLI
-
描述資料庫執行個體的有效修改
下列
describe-valid-db-instance-modifications
範例會擷取指定資料庫執行個體有效修改的詳細資訊。aws rds describe-valid-db-instance-modifications \ --db-instance-identifier
test-instance
輸出:
{ "ValidDBInstanceModificationsMessage": { "ValidProcessorFeatures": [], "Storage": [ { "StorageSize": [ { "Step": 1, "To": 20, "From": 20 }, { "Step": 1, "To": 6144, "From": 22 } ], "ProvisionedIops": [ { "Step": 1, "To": 0, "From": 0 } ], "IopsToStorageRatio": [ { "To": 0.0, "From": 0.0 } ], "StorageType": "gp2" }, { "StorageSize": [ { "Step": 1, "To": 6144, "From": 100 } ], "ProvisionedIops": [ { "Step": 1, "To": 40000, "From": 1000 } ], "IopsToStorageRatio": [ { "To": 50.0, "From": 1.0 } ], "StorageType": "io1" }, { "StorageSize": [ { "Step": 1, "To": 20, "From": 20 }, { "Step": 1, "To": 3072, "From": 22 } ], "ProvisionedIops": [ { "Step": 1, "To": 0, "From": 0 } ], "IopsToStorageRatio": [ { "To": 0.0, "From": 0.0 } ], "StorageType": "magnetic" } ] } }
-
如需API詳細資訊,請參閱 命令參考 DescribeValidDbInstanceModifications
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 download-db-log-file-portion
。
- AWS CLI
-
若要下載資料庫日誌檔案
下列
download-db-log-file-portion
範例只會下載日誌檔案的最新部分,並將其儲存至名為 的本機檔案tail.txt
。aws rds download-db-log-file-portion \ --db-instance-identifier
test-instance
\ --log-file-namelog.txt
\ --outputtext
>
tail.txt
若要下載整個檔案,您需要包含
--starting-token 0
參數。下列範例會將輸出儲存至名為 的本機檔案full.txt
。aws rds download-db-log-file-portion \ --db-instance-identifier
test-instance
\ --log-file-namelog.txt
\ --starting-token0
\ --outputtext
>
full.txt
儲存的檔案可能包含空白行。下載時,它們會出現在日誌檔案每個部分的結尾。這通常不會在您的日誌檔案分析中造成任何問題。
-
如需API詳細資訊,請參閱 命令參考 DownloadDbLogFilePortion
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 generate-auth-token
。
- AWS CLI
-
若要產生身分驗證權杖
下列
generate-db-auth-token
範例會產生驗證權杖,以搭配IAM資料庫身分驗證使用。aws rds generate-db-auth-token \ --hostname
aurmysql-test.cdgmuqiadpid.us-west-2.rds.amazonaws.com
\ --port3306
\ --regionus-east-1
\ --usernamejane_doe
輸出:
aurmysql-test.cdgmuqiadpid.us-west-2.rds.amazonaws.com:3306/?Action=connect&DBUser=jane_doe&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIESZCNJ3OEXAMPLE%2F20180731%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=20180731T235209Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=5a8753ebEXAMPLEa2c724e5667797EXAMPLE9d6ec6e3f427191fa41aeEXAMPLE
-
如需API詳細資訊,請參閱 命令參考 GenerateAuthToken
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 generate-db-auth-token
。
- AWS CLI
-
若要產生IAM身分驗證權杖
下列
generate-db-auth-token
範例會產生IAM身分驗證權杖以連線至資料庫。aws rds generate-db-auth-token \ --hostname
mydb.123456789012.us-east-1.rds.amazonaws.com
\ --port3306
\ --regionus-east-1
\ --usernamedb_user
輸出:
mydb.123456789012.us-east-1.rds.amazonaws.com:3306/?Action=connect&DBUser=db_user&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEXAMPLE%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=20210123T011543Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=88987EXAMPLE1EXAMPLE2EXAMPLE3EXAMPLE4EXAMPLE5EXAMPLE6
如需詳細資訊,請參閱 Amazon RDS使用者指南中的使用IAM身分驗證連線至資料庫執行個體,以及 Amazon Aurora 使用者指南 中的使用IAM身分驗證連線至資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 GenerateDbAuthToken
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 list-tags-for-resource
。
- AWS CLI
-
列出 Amazon RDS 資源上的標籤
下列
list-tags-for-resource
範例會列出資料庫執行個體上的所有標籤。aws rds list-tags-for-resource \ --resource-name
arn:aws:rds:us-east-1:123456789012:db:orcl1
輸出:
{ "TagList": [ { "Key": "Environment", "Value": "test" }, { "Key": "Name", "Value": "MyDatabase" } ] }
如需詳細資訊,請參閱 Amazon 使用者指南 中的標記 Amazon RDS 資源。 RDS
-
如需API詳細資訊,請參閱 命令參考 ListTagsForResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-certificates
。
- AWS CLI
-
暫時覆寫新資料庫執行個體的系統預設SSL/TLS憑證
下列
modify-certificates
範例會暫時覆寫新資料庫執行個體的系統預設SSL/TLS憑證。aws rds modify-certificates \ --certificate-identifier
rds-ca-2019
輸出:
{ "Certificate": { "CertificateIdentifier": "rds-ca-2019", "CertificateType": "CA", "Thumbprint": "EXAMPLE123456789012", "ValidFrom": "2019-09-19T18:16:53Z", "ValidTill": "2024-08-22T17:08:50Z", "CertificateArn": "arn:aws:rds:us-east-1::cert:rds-ca-2019", "CustomerOverride": true, "CustomerOverrideValidTill": "2024-08-22T17:08:50Z" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的輪換您的 SSL/TLS 憑證,以及 Amazon Aurora 使用者指南中的輪換您的 SSL/TLS 憑證。
-
如需API詳細資訊,請參閱 命令參考 ModifyCertificates
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-current-db-cluster-capacity
。
- AWS CLI
-
擴展 Aurora Serverless 資料庫叢集的容量
下列
modify-current-db-cluster-capacity
範例會將 Aurora Serverless 資料庫叢集的容量擴展至 8。aws rds modify-current-db-cluster-capacity \ --db-cluster-identifier
mydbcluster
\ --capacity8
輸出:
{ "DBClusterIdentifier": "mydbcluster", "PendingCapacity": 8, "CurrentCapacity": 1, "SecondsBeforeTimeout": 300, "TimeoutAction": "ForceApplyCapacityChange" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的手動擴展 Aurora Serverless v1 資料庫叢集容量。
-
如需API詳細資訊,請參閱 命令參考 ModifyCurrentDbClusterCapacity
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-cluster-endpoint
。
- AWS CLI
-
若要修改自訂資料庫叢集端點
下列
modify-db-cluster-endpoint
範例會修改指定的自訂資料庫叢集端點。aws rds modify-db-cluster-endpoint \ --db-cluster-endpoint-identifier
mycustomendpoint
\ --static-membersdbinstance1
dbinstance2
dbinstance3
輸出:
{ "DBClusterEndpointIdentifier": "mycustomendpoint", "DBClusterIdentifier": "mydbcluster", "DBClusterEndpointResourceIdentifier": "cluster-endpoint-ANPAJ4AE5446DAEXAMPLE", "Endpoint": "mycustomendpoint.cluster-custom-cnpexample.us-east-1.rds.amazonaws.com", "Status": "modifying", "EndpointType": "CUSTOM", "CustomEndpointType": "READER", "StaticMembers": [ "dbinstance1", "dbinstance2", "dbinstance3" ], "ExcludedMembers": [], "DBClusterEndpointArn": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:mycustomendpoint" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora Connection Management。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbClusterEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-cluster-parameter-group
。
- AWS CLI
-
若要修改資料庫叢集參數群組中的參數
下列
modify-db-cluster-parameter-group
範例會修改資料庫叢集參數群組中的參數值。aws rds modify-db-cluster-parameter-group \ --db-cluster-parameter-group-name
mydbclusterpg
\ --parameters"ParameterName=server_audit_logging,ParameterValue=1,ApplyMethod=immediate"
\"ParameterName=server_audit_logs_upload,ParameterValue=1,ApplyMethod=immediate"
輸出:
{ "DBClusterParameterGroupName": "mydbclusterpg" }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbClusterParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-cluster-snapshot-attribute
。
- AWS CLI
-
若要修改資料庫叢集快照屬性
下列
modify-db-cluster-snapshot-attribute
範例會變更指定的資料庫叢集快照屬性。aws rds modify-db-cluster-snapshot-attribute \ --db-cluster-snapshot-identifier
myclustersnapshot
\ --attribute-namerestore
\ --values-to-add123456789012
輸出:
{ "DBClusterSnapshotAttributesResult": { "DBClusterSnapshotIdentifier": "myclustersnapshot", "DBClusterSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "123456789012" ] } ] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的從資料庫叢集快照還原。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbClusterSnapshotAttribute
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-cluster
。
- AWS CLI
-
範例 1:修改資料庫叢集
下列
modify-db-cluster
範例會變更名為 的資料庫叢集的主要使用者密碼,cluster-2
並將備份保留期設定為 14 天。參數--apply-immediately
會導致立即進行變更,而不是等到下一個維護時段。aws rds modify-db-cluster \ --db-cluster-identifier
cluster-2
\ --backup-retention-period14
\ --master-user-passwordnewpassword99
\ --apply-immediately輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "eu-central-1b", "eu-central-1c", "eu-central-1a" ], "BackupRetentionPeriod": 14, "DatabaseName": "", "DBClusterIdentifier": "cluster-2", "DBClusterParameterGroup": "default.aurora5.6", "DBSubnetGroup": "default-vpc-2305ca49", "Status": "available", "EarliestRestorableTime": "2020-06-03T02:07:29.637Z", "Endpoint": "cluster-2.cluster-############.eu-central-1.rds.amazonaws.com", "ReaderEndpoint": "cluster-2.cluster-ro-############.eu-central-1.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora", "EngineVersion": "5.6.10a", "LatestRestorableTime": "2020-06-04T15:11:25.748Z", "Port": 3306, "MasterUsername": "admin", "PreferredBackupWindow": "01:55-02:25", "PreferredMaintenanceWindow": "thu:21:14-thu:21:44", "ReadReplicaIdentifiers": [], "DBClusterMembers": [ { "DBInstanceIdentifier": "cluster-2-instance-1", "IsClusterWriter": true, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 } ], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-20a5c047", "Status": "active" } ], "HostedZoneId": "Z1RLNU0EXAMPLE", "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:eu-central-1:123456789012:key/d1bd7c8f-5cdb-49ca-8a62-a1b2c3d4e5f6", "DbClusterResourceId": "cluster-AGJ7XI77XVIS6FUXHU1EXAMPLE", "DBClusterArn": "arn:aws:rds:eu-central-1:123456789012:cluster:cluster-2", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "ClusterCreateTime": "2020-04-03T14:44:02.764Z", "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false, "CopyTagsToSnapshot": true, "CrossAccountClone": false, "DomainMemberships": [] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的修改 Amazon Aurora 資料庫叢集。
範例 2:將VPC安全群組與資料庫叢集建立關聯
下列
modify-db-instance
範例會建立特定VPC安全群組的關聯,並從資料庫叢集中移除資料庫安全群組。aws rds modify-db-cluster \ --db-cluster-identifier
dbName
\ --vpc-security-group-idssg-ID
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-west-2c", "us-west-2b", "us-west-2a" ], "BackupRetentionPeriod": 1, "DBClusterIdentifier": "dbName", "DBClusterParameterGroup": "default.aurora-mysql8.0", "DBSubnetGroup": "default", "Status": "available", "EarliestRestorableTime": "2024-02-15T01:12:13.966000+00:00", "Endpoint": "dbName.cluster-abcdefghji.us-west-2.rds.amazonaws.com", "ReaderEndpoint": "dbName.cluster-ro-abcdefghji.us-west-2.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.04.1", "LatestRestorableTime": "2024-02-15T02:25:33.696000+00:00", "Port": 3306, "MasterUsername": "admin", "PreferredBackupWindow": "10:59-11:29", "PreferredMaintenanceWindow": "thu:08:54-thu:09:24", "ReadReplicaIdentifiers": [], "DBClusterMembers": [ { "DBInstanceIdentifier": "dbName-instance-1", "IsClusterWriter": true, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 1 } ], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-ID", "Status": "active" } ], ...output omitted... } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的使用安全群組控制存取權。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-instance
。
- AWS CLI
-
範例 1:修改資料庫執行個體
下列
modify-db-instance
範例會將選項群組和參數群組與相容的 Microsoft SQL Server 資料庫執行個體建立關聯。參數--apply-immediately
會導致選項和參數群組立即建立關聯,而不是等到下一個維護時段。aws rds modify-db-instance \ --db-instance-identifier
database-2
\ --option-group-nametest-se-2017
\ --db-parameter-group-nametest-sqlserver-se-2017
\ --apply-immediately輸出:
{ "DBInstance": { "DBInstanceIdentifier": "database-2", "DBInstanceClass": "db.r4.large", "Engine": "sqlserver-se", "DBInstanceStatus": "available", ...output omitted... "DBParameterGroups": [ { "DBParameterGroupName": "test-sqlserver-se-2017", "ParameterApplyStatus": "applying" } ], "AvailabilityZone": "us-west-2d", ...output omitted... "MultiAZ": true, "EngineVersion": "14.00.3281.6.v1", "AutoMinorVersionUpgrade": false, "ReadReplicaDBInstanceIdentifiers": [], "LicenseModel": "license-included", "OptionGroupMemberships": [ { "OptionGroupName": "test-se-2017", "Status": "pending-apply" } ], "CharacterSetName": "SQL_Latin1_General_CP1_CI_AS", "SecondaryAvailabilityZone": "us-west-2c", "PubliclyAccessible": true, "StorageType": "gp2", ...output omitted... "DeletionProtection": false, "AssociatedRoles": [], "MaxAllocatedStorage": 1000 } }
如需詳細資訊,請參閱 Amazon 使用者指南 中的修改 Amazon RDS 資料庫執行個體。 RDS
範例 2:將VPC安全群組與資料庫執行個體建立關聯
下列
modify-db-instance
範例會建立特定VPC安全群組的關聯,並從資料庫執行個體中移除資料庫安全群組:aws rds modify-db-instance \ --db-instance-identifier
dbName
\ --vpc-security-group-idssg-ID
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "dbName", "DBInstanceClass": "db.t3.micro", "Engine": "mysql", "DBInstanceStatus": "available", "MasterUsername": "admin", "Endpoint": { "Address": "dbName.abcdefghijk.us-west-2.rds.amazonaws.com", "Port": 3306, "HostedZoneId": "ABCDEFGHIJK1234" }, "AllocatedStorage": 20, "InstanceCreateTime": "2024-02-15T00:37:58.793000+00:00", "PreferredBackupWindow": "11:57-12:27", "BackupRetentionPeriod": 7, "DBSecurityGroups": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-ID", "Status": "active" } ], ... output omitted ... "MultiAZ": false, "EngineVersion": "8.0.35", "AutoMinorVersionUpgrade": true, "ReadReplicaDBInstanceIdentifiers": [], "LicenseModel": "general-public-license", ... output ommited ... } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的使用安全群組控制存取權。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 ModifyDBInstance
。
-
下列程式碼範例示範如何使用 modify-db-parameter-group
。
- AWS CLI
-
若要修改資料庫參數群組
下列
modify-db-parameter-group
範例會變更資料庫clr enabled
參數群組中參數的值。參數--apply-immediately
會立即修改資料庫參數群組,而不是等到下一個維護時段。aws rds modify-db-parameter-group \ --db-parameter-group-name
test-sqlserver-se-2017
\ --parameters"ParameterName='clr enabled',ParameterValue=1,ApplyMethod=immediate"
輸出:
{ "DBParameterGroupName": "test-sqlserver-se-2017" }
如需詳細資訊,請參閱 Amazon RDS 使用者指南 中的修改資料庫參數群組中的參數。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 M odifyDBParameter群組
。
-
下列程式碼範例示範如何使用 modify-db-proxy-endpoint
。
- AWS CLI
-
修改RDS資料庫的資料庫代理端點
下列
modify-db-proxy-endpoint
範例修改資料庫代理端點proxyEndpoint
,將讀取逾時設定為 65 秒。aws rds modify-db-proxy-endpoint \ --db-proxy-endpoint-name
proxyEndpoint
\ --cli-read-timeout65
輸出:
{ "DBProxyEndpoint": { "DBProxyEndpointName": "proxyEndpoint", "DBProxyEndpointArn": "arn:aws:rds:us-east-1:123456789012:db-proxy-endpoint:prx-endpoint-0123a01b12345c0ab", "DBProxyName": "proxyExample", "Status": "available", "VpcId": "vpc-1234567", "VpcSecurityGroupIds": [ "sg-1234" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Endpoint": "proxyEndpoint.endpoint.proxyExample-ab0cd1efghij.us-east-1.rds.amazonaws.com", "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "TargetRole": "READ_WRITE", "IsDefault": "false" } }
如需詳細資訊,請參閱 Amazon RDS 使用者指南中的修改代理端點和 Amazon Aurora 使用者指南中的修改代理端點。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbProxyEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-proxy-target-group
。
- AWS CLI
-
若要修改資料庫代理端點
下列
modify-db-proxy-target-group
範例修改資料庫代理目標群組,將最大連線設定為 80%,最大閒置連線設定為 10%。aws rds modify-db-proxy-target-group \ --target-group-name
default
\ --db-proxy-nameproxyExample
\ --connection-pool-configMaxConnectionsPercent=80,MaxIdleConnectionsPercent=10
輸出:
{ "DBProxyTargetGroup": { "DBProxyName": "proxyExample", "TargetGroupName": "default", "TargetGroupArn": "arn:aws:rds:us-east-1:123456789012:target-group:prx-tg-0123a01b12345c0ab", "IsDefault": true, "Status": "available", "ConnectionPoolConfig": { "MaxConnectionsPercent": 80, "MaxIdleConnectionsPercent": 10, "ConnectionBorrowTimeout": 120, "SessionPinningFilters": [] }, "CreatedDate": "2023-05-02T18:41:19.495000+00:00", "UpdatedDate": "2023-05-02T18:41:21.762000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的修改RDS代理,以及 Amazon Aurora 使用者指南中的修改RDS代理。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbProxyTargetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-proxy
。
- AWS CLI
-
修改RDS資料庫的資料庫代理
下列
modify-db-proxy
範例會修改名為 SSL的資料庫代理proxyExample
,以要求其連線。aws rds modify-db-proxy \ --db-proxy-name
proxyExample
\ --require-tls輸出:
{ "DBProxy": { "DBProxyName": "proxyExample", "DBProxyArn": "arn:aws:rds:us-east-1:123456789012:db-proxy:prx-0123a01b12345c0ab", "Status": "modifying" "EngineFamily": "PostgreSQL", "VpcId": "sg-1234567", "VpcSecurityGroupIds": [ "sg-1234" ], "VpcSubnetIds": [ "subnetgroup1", "subnetgroup2" ], "Auth": "[ { "Description": "proxydescription1", "AuthScheme": "SECRETS", "SecretArn": "arn:aws:secretsmanager:us-west-2:123456789123:secret:proxysecret1-Abcd1e", "IAMAuth": "DISABLED" } ]", "RoleArn": "arn:aws:iam::12345678912:role/ProxyPostgreSQLRole", "Endpoint": "proxyExample.proxy-ab0cd1efghij.us-east-1.rds.amazonaws.com", "RequireTLS": true, "IdleClientTimeout": 1800, "DebuggingLogging": false, "CreatedDate": "2023-04-05T16:09:33.452000+00:00", "UpdatedDate": "2023-04-13T01:49:38.568000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的修改RDS代理,以及 Amazon Aurora 使用者指南中的建立RDS代理。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbProxy
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-shard-group
。
- AWS CLI
-
範例 1:修改資料庫碎片群組
下列
modify-db-shard-group
範例會變更資料庫碎片群組的最大容量。aws rds modify-db-shard-group \ --db-shard-group-identifier
my-db-shard-group
\ --max-acu1000
輸出:
{ "DBShardGroups": [ { "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora 資料庫叢集。
範例 2:描述資料庫碎片群組
下列
describe-db-shard-groups
範例會在您執行modify-db-shard-group
命令後擷取資料庫碎片群組的詳細資訊。資料庫碎片群組的最大容量現在my-db-shard-group
是 1000 個 Aurora 容量單位 (ACUs)。aws rds describe-db-shard-groups
輸出:
{ "DBShardGroups": [ { "DBShardGroupResourceId": "shardgroup-7bb446329da94788b3f957746example", "DBShardGroupIdentifier": "limitless-test-shard-grp", "DBClusterIdentifier": "limitless-test-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": true, "Endpoint": "limitless-test-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" }, { "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 1000.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" } ] }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbShardGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-snapshot-attribute
。
- AWS CLI
-
範例 1:啟用兩個 AWS 帳戶以還原資料庫快照
下列
modify-db-snapshot-attribute
範例將許可授予兩個 AWS 帳戶,其中包含識別碼111122223333
和444455556666
,以還原名為 的資料庫快照mydbsnapshot
。aws rds modify-db-snapshot-attribute \ --db-snapshot-identifier
mydbsnapshot
\ --attribute-namerestore
\ --values-to-add {"111122223333","444455556666"}輸出:
{ "DBSnapshotAttributesResult": { "DBSnapshotIdentifier": "mydbsnapshot", "DBSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "111122223333", "444455556666" ] } ] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的共用快照。
範例 2:防止 AWS 帳戶還原資料庫快照
下列
modify-db-snapshot-attribute
範例會移除特定 AWS 帳戶的許可,以還原名為 的資料庫快照mydbsnapshot
。指定單一帳戶時,帳戶識別符無法被引號或括號包圍。aws rds modify-db-snapshot-attribute \ --db-snapshot-identifier
mydbsnapshot
\ --attribute-namerestore
\ --values-to-remove444455556666
輸出:
{ "DBSnapshotAttributesResult": { "DBSnapshotIdentifier": "mydbsnapshot", "DBSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "111122223333" ] } ] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的共用快照。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbSnapshotAttribute
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-snapshot-attributes
。
- AWS CLI
-
若要修改資料庫快照屬性
下列
modify-db-snapshot-attribute
範例允許兩個 AWS 帳戶識別符111122223333
和444455556666
還原名為 的資料庫快照mydbsnapshot
。aws rds modify-db-snapshot-attribute \ --db-snapshot-identifier
mydbsnapshot
\ --attribute-namerestore
\ --values-to-add '["111122223333","444455556666"]
'輸出:
{ "DBSnapshotAttributesResult": { "DBSnapshotIdentifier": "mydbsnapshot", "DBSnapshotAttributes": [ { "AttributeName": "restore", "AttributeValues": [ "111122223333", "444455556666" ] } ] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的共用快照。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbSnapshotAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-snapshot
。
- AWS CLI
-
若要修改資料庫快照
下列
modify-db-snapshot
範例會將名為 Postgre 11.7 的 PostgeSQL 10.6 快照升級為db5-snapshot-upg-test
PostgreSQL 11.7。新的資料庫引擎版本會在快照完成升級且其狀態為可用後顯示。aws rds modify-db-snapshot \ --db-snapshot-identifier
db5-snapshot-upg-test
\ --engine-version11.7
輸出:
{ "DBSnapshot": { "DBSnapshotIdentifier": "db5-snapshot-upg-test", "DBInstanceIdentifier": "database-5", "SnapshotCreateTime": "2020-03-27T20:49:17.092Z", "Engine": "postgres", "AllocatedStorage": 20, "Status": "upgrading", "Port": 5432, "AvailabilityZone": "us-west-2a", "VpcId": "vpc-2ff27557", "InstanceCreateTime": "2020-03-27T19:59:04.735Z", "MasterUsername": "postgres", "EngineVersion": "10.6", "LicenseModel": "postgresql-license", "SnapshotType": "manual", "OptionGroupName": "default:postgres-11", "PercentProgress": 100, "StorageType": "gp2", "Encrypted": false, "DBSnapshotArn": "arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-upg-test", "IAMDatabaseAuthenticationEnabled": false, "ProcessorFeatures": [], "DbiResourceId": "db-GJMF75LM42IL6BTFRE4UZJ5YM4" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的升級 PostgreSQL 資料庫快照。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-db-subnet-group
。
- AWS CLI
-
若要修改資料庫子網路群組
下列
modify-db-subnet-group
範例會將 ID 為 的子網路新增至名為subnet-08e41f9e230222222
的資料庫子網路群組mysubnetgroup
。若要保留子網路群組中的現有子網路,請在--subnet-ids
選項中將它們IDs作為值。確保資料庫子網路群組中至少有兩個不同可用區域的子網路。aws rds modify-db-subnet-group \ --db-subnet-group-name
mysubnetgroup
\ --subnet-ids '["subnet-0a1dc4e1a6f123456","subnet-070dd7ecb3aaaaaaa","subnet-00f5b198bc0abcdef","subnet-08e41f9e230222222"]
'輸出:
{ "DBSubnetGroup": { "DBSubnetGroupName": "mysubnetgroup", "DBSubnetGroupDescription": "test DB subnet group", "VpcId": "vpc-0f08e7610a1b2c3d4", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-08e41f9e230222222", "SubnetAvailabilityZone": { "Name": "us-west-2a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-070dd7ecb3aaaaaaa", "SubnetAvailabilityZone": { "Name": "us-west-2b" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-00f5b198bc0abcdef", "SubnetAvailabilityZone": { "Name": "us-west-2d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-0a1dc4e1a6f123456", "SubnetAvailabilityZone": { "Name": "us-west-2b" }, "SubnetStatus": "Active" } ], "DBSubnetGroupArn": "arn:aws:rds:us-west-2:534026745191:subgrp:mysubnetgroup" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的步驟 3:建立資料庫子網路群組。
-
如需API詳細資訊,請參閱 命令參考 ModifyDbSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-event-subscription
。
- AWS CLI
-
若要修改事件訂閱
下列
modify-event-subscription
範例會停用指定的事件訂閱,使其不再將通知發佈至指定的 Amazon Simple Notification Service 主題。aws rds modify-event-subscription \ --subscription-name
my-instance-events
\ --no-enabled輸出:
{ "EventSubscription": { "EventCategoriesList": [ "backup", "recovery" ], "CustomerAwsId": "123456789012", "SourceType": "db-instance", "SubscriptionCreationTime": "Tue Jul 31 23:22:01 UTC 2018", "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events", "CustSubscriptionId": "my-instance-events", "Status": "modifying", "Enabled": false } }
-
如需API詳細資訊,請參閱 命令參考 ModifyEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-global-cluster
。
- AWS CLI
-
若要修改全域資料庫叢集
下列
modify-global-cluster
範例會啟用 Aurora My SQL相容全域資料庫叢集的刪除保護。aws rds modify-global-cluster \ --global-cluster-identifier
myglobalcluster
\ --deletion-protection輸出:
{ "GlobalCluster": { "GlobalClusterIdentifier": "myglobalcluster", "GlobalClusterResourceId": "cluster-f0e523bfe07aabb", "GlobalClusterArn": "arn:aws:rds::123456789012:global-cluster:myglobalcluster", "Status": "available", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.07.2", "StorageEncrypted": false, "DeletionProtection": true, "GlobalClusterMembers": [] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的管理 Aurora 全域資料庫。
-
如需API詳細資訊,請參閱 命令參考 ModifyGlobalCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 promote-read-replica-db-cluster
。
- AWS CLI
-
提升資料庫叢集僅供讀取複本
下列
promote-read-replica-db-cluster
範例會將指定的僅供讀取複本提升為獨立的資料庫叢集。aws rds promote-read-replica-db-cluster \ --db-cluster-identifier
mydbcluster-1
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c" ], "BackupRetentionPeriod": 1, "DatabaseName": "", "DBClusterIdentifier": "mydbcluster-1", ...some output truncated... } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的將僅供讀取複本提升為資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 PromoteReadReplicaDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 promote-read-replica
。
- AWS CLI
-
提升僅供讀取複本
下列
promote-read-replica
範例會將指定的僅供讀取複本提升為獨立的資料庫執行個體。aws rds promote-read-replica \ --db-instance-identifier
test-instance-repl
輸出:
{ "DBInstance": { "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance-repl", "StorageType": "standard", "ReadReplicaSourceDBInstanceIdentifier": "test-instance", "DBInstanceStatus": "modifying", ...some output truncated... } }
-
如需API詳細資訊,請參閱 命令參考 PromoteReadReplica
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 purchase-reserved-db-instance
。
- AWS CLI
-
購買預留資料庫執行個體方案
下列
purchase-reserved-db-instances-offering
範例會購買預留資料庫執行個體方案。reserved-db-instances-offering-id
必須是有效的方案 ID,如describe-reserved-db-instances-offering
命令所傳回。aws rds purchase-reserved-db-instances-offering --reserved-db-instances-offeringid 438012d3-4a52-4cc7-b2e3-8dff72e0e706
-
如需API詳細資訊,請參閱 命令參考 PurchaseReservedDbInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 purchase-reserved-db-instances-offerings
。
- AWS CLI
-
範例 1:尋找要購買的預留資料庫執行個體
下列
describe-reserved-db-instances-offerings
範例列出具有 db.t2.micro 執行個體類別和一年持續時間的可用預留 MySQL 資料庫執行個體。購買預留資料庫執行個體時,需要 優惠 ID。aws rds describe-reserved-db-instances-offerings \ --product-description
mysql
\ --db-instance-classdb.t2.micro
\ --duration1
輸出:
{ "ReservedDBInstancesOfferings": [ { "ReservedDBInstancesOfferingId": "8ba30be1-b9ec-447f-8f23-6114e3f4c7b4", "DBInstanceClass": "db.t2.micro", "Duration": 31536000, "FixedPrice": 51.0, "UsagePrice": 0.0, "CurrencyCode": "USD", "ProductDescription": "mysql", "OfferingType": "Partial Upfront", "MultiAZ": false, "RecurringCharges": [ { "RecurringChargeAmount": 0.006, "RecurringChargeFrequency": "Hourly" } ] }, ... some output truncated ... ] }
如需詳細資訊,請參閱 Amazon 使用者指南 中的 Amazon 預留資料庫執行個體RDS。 RDS
範例 2:購買預留資料庫執行個體
下列
purchase-reserved-db-instances-offering
範例顯示如何從上一個範例購買預留資料庫執行個體方案。aws rds purchase-reserved-db-instances-offering --reserved-db-instances-offeringid 8ba30be1-b9ec-447f-8f23-6114e3f4c7b4
輸出:
{ "ReservedDBInstance": { "ReservedDBInstanceId": "ri-2020-06-29-16-54-57-670", "ReservedDBInstancesOfferingId": "8ba30be1-b9ec-447f-8f23-6114e3f4c7b4", "DBInstanceClass": "db.t2.micro", "StartTime": "2020-06-29T16:54:57.670Z", "Duration": 31536000, "FixedPrice": 51.0, "UsagePrice": 0.0, "CurrencyCode": "USD", "DBInstanceCount": 1, "ProductDescription": "mysql", "OfferingType": "Partial Upfront", "MultiAZ": false, "State": "payment-pending", "RecurringCharges": [ { "RecurringChargeAmount": 0.006, "RecurringChargeFrequency": "Hourly" } ], "ReservedDBInstanceArn": "arn:aws:rds:us-west-2:123456789012:ri:ri-2020-06-29-16-54-57-670" } }
如需詳細資訊,請參閱 Amazon 使用者指南 中的 Amazon 預留資料庫執行個體RDS。 RDS
-
如需API詳細資訊,請參閱 命令參考 PurchaseReservedDbInstancesOfferings
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 reboot-db-instance
。
- AWS CLI
-
若要重新啟動資料庫執行個體
下列
reboot-db-instance
範例會啟動指定資料庫執行個體的重新啟動。aws rds reboot-db-instance \ --db-instance-identifier
test-mysql-instance
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "test-mysql-instance", "DBInstanceClass": "db.t3.micro", "Engine": "mysql", "DBInstanceStatus": "rebooting", "MasterUsername": "admin", "Endpoint": { "Address": "test-mysql-instance.############.us-west-2.rds.amazonaws.com", "Port": 3306, "HostedZoneId": "Z1PVIF0EXAMPLE" }, ... output omitted... } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的重新啟動資料庫執行個體。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 RebootDBInstance
。
-
下列程式碼範例示範如何使用 reboot-db-shard-group
。
- AWS CLI
-
範例 1:重新啟動資料庫碎片群組
下列
reboot-db-shard-group
範例會重新啟動資料庫碎片群組。aws rds reboot-db-shard-group \ --db-shard-group-identifier
my-db-shard-group
輸出:
{ "DBShardGroups": [ { "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 1000.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" } ] }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的重新啟動 Amazon Aurora 資料庫叢集或 Amazon Aurora 資料庫執行個體。
範例 2:描述資料庫碎片群組
下列
describe-db-shard-groups
範例會在您執行reboot-db-shard-group
命令後擷取資料庫碎片群組的詳細資訊。資料庫碎片群組現在my-db-shard-group
正在重新啟動。aws rds describe-db-shard-groups
輸出:
{ "DBShardGroups": [ { "DBShardGroupResourceId": "shardgroup-7bb446329da94788b3f957746example", "DBShardGroupIdentifier": "limitless-test-shard-grp", "DBClusterIdentifier": "limitless-test-cluster", "MaxACU": 768.0, "ComputeRedundancy": 0, "Status": "available", "PubliclyAccessible": true, "Endpoint": "limitless-test-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" }, { "DBShardGroupResourceId": "shardgroup-a6e3a0226aa243e2ac6c7a1234567890", "DBShardGroupIdentifier": "my-db-shard-group", "DBClusterIdentifier": "my-sv2-cluster", "MaxACU": 1000.0, "ComputeRedundancy": 0, "Status": "rebooting", "PubliclyAccessible": false, "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-east-2.rds.amazonaws.com" } ] }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的重新啟動 Amazon Aurora 資料庫叢集或 Amazon Aurora 資料庫執行個體。
-
如需API詳細資訊,請參閱 命令參考 RebootDbShardGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 register-db-proxy-targets
。
- AWS CLI
-
向資料庫註冊資料庫代理
下列
register-db-proxy-targets
範例會在資料庫與代理之間建立關聯。aws rds register-db-proxy-targets \ --db-proxy-name
proxyExample
\ --db-cluster-identifiersdatabase-5
輸出:
{ "DBProxyTargets": [ { "RdsResourceId": "database-5", "Port": 3306, "Type": "TRACKED_CLUSTER", "TargetHealth": { "State": "REGISTERING" } }, { "Endpoint": "database-5instance-1.ab0cd1efghij.us-east-1.rds.amazonaws.com", "RdsResourceId": "database-5", "Port": 3306, "Type": "RDS_INSTANCE", "TargetHealth": { "State": "REGISTERING" } } ] }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的建立RDS代理和 Amazon Aurora 使用者指南中的建立RDS代理。
-
如需API詳細資訊,請參閱 命令參考 RegisterDbProxyTargets
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-from-global-cluster
。
- AWS CLI
-
從 Aurora 全域資料庫叢集分離 Aurora 次要叢集
下列
remove-from-global-cluster
範例會將 Aurora 次要叢集與 Aurora 全域資料庫叢集分離。叢集會從唯讀變更為具有讀寫能力的獨立叢集。aws rds remove-from-global-cluster \ --region
us-west-2
\ --global-cluster-identifiermyglobalcluster
\ --db-cluster-identifierarn:aws:rds:us-west-2:123456789012:cluster:DB-1
輸出:
{ "GlobalCluster": { "GlobalClusterIdentifier": "myglobalcluster", "GlobalClusterResourceId": "cluster-abc123def456gh", "GlobalClusterArn": "arn:aws:rds::123456789012:global-cluster:myglobalcluster", "Status": "available", "Engine": "aurora-postgresql", "EngineVersion": "10.11", "StorageEncrypted": true, "DeletionProtection": false, "GlobalClusterMembers": [ { "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:js-global-cluster", "Readers": [ "arn:aws:rds:us-west-2:123456789012:cluster:DB-1" ], "IsWriter": true }, { "DBClusterArn": "arn:aws:rds:us-west-2:123456789012:cluster:DB-1", "Readers": [], "IsWriter": false, "GlobalWriteForwardingStatus": "disabled" } ] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的從 Amazon Aurora 全域資料庫移除叢集。
-
如需API詳細資訊,請參閱 命令參考 RemoveFromGlobalCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-option-from-option-group
。
- AWS CLI
-
從選項群組中刪除選項
下列
remove-option-from-option-group
範例會從 移除OEM
選項myoptiongroup
。aws rds remove-option-from-option-group \ --option-group-name
myoptiongroup
\ --optionsOEM
\ --apply-immediately輸出:
{ "OptionGroup": { "OptionGroupName": "myoptiongroup", "OptionGroupDescription": "Test", "EngineName": "oracle-ee", "MajorEngineVersion": "19", "Options": [], "AllowsVpcAndNonVpcInstanceMemberships": true, "OptionGroupArn": "arn:aws:rds:us-east-1:123456789012:og:myoptiongroup" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的從選項群組移除選項。
-
如需API詳細資訊,請參閱 命令參考 RemoveOptionFromOptionGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-role-from-db-cluster
。
- AWS CLI
-
取消 AWS 身分和存取管理 (IAM) 角色與資料庫叢集的關聯
下列
remove-role-from-db-cluster
範例會從資料庫叢集移除角色。aws rds remove-role-from-db-cluster \ --db-cluster-identifier
mydbcluster
\ --role-arnarn:aws:iam::123456789012:role/RDSLoadFromS3
此命令不會產生輸出。
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的將IAM角色與 Amazon Aurora MySQL 資料庫叢集建立關聯。
-
如需API詳細資訊,請參閱 命令參考 RemoveRoleFromDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-role-from-db-instance
。
- AWS CLI
-
取消 AWS 身分和存取管理 (IAM) 角色與資料庫執行個體的關聯
下列
remove-role-from-db-instance
範例rds-s3-integration-role
會從名為 的 Oracle 資料庫執行個體中移除名為 的角色test-instance
。aws rds remove-role-from-db-instance \ --db-instance-identifier
test-instance
\ --feature-nameS3_INTEGRATION
\ --role-arnarn:aws:iam::111122223333:role/rds-s3-integration-role
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的停用與 S3 的RDSSQL伺服器整合。
-
如需API詳細資訊,請參閱 命令參考 RemoveRoleFromDbInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-source-identifier-from-subscription
。
- AWS CLI
-
從訂閱中移除來源識別符
下列
remove-source-identifier
範例會從現有訂閱中移除指定的來源識別符。aws rds remove-source-identifier-from-subscription \ --subscription-name
my-instance-events
\ --source-identifiertest-instance-repl
輸出:
{ "EventSubscription": { "EventSubscriptionArn": "arn:aws:rds:us-east-1:123456789012:es:my-instance-events", "SubscriptionCreationTime": "Tue Jul 31 23:22:01 UTC 2018", "EventCategoriesList": [ "backup", "recovery" ], "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:interesting-events", "Status": "modifying", "CustSubscriptionId": "my-instance-events", "CustomerAwsId": "123456789012", "SourceIdsList": [ "test-instance" ], "SourceType": "db-instance", "Enabled": false } }
-
如需API詳細資訊,請參閱 命令參考 RemoveSourceIdentifierFromSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 remove-tags-from-resource
。
- AWS CLI
-
從資源中移除標籤
下列
remove-tags-from-resource
範例會從資源中移除標籤。aws rds remove-tags-from-resource \ --resource-name
arn:aws:rds:us-east-1:123456789012:db:mydbinstance
\ --tag-keysName
Environment
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 RDS RDS 中的標記 Amazon RDS 資源和 Amazon 資源的標記。
-
如需API詳細資訊,請參閱 命令參考 RemoveTagsFromResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 reset-db-cluster-parameter-group
。
- AWS CLI
-
範例 1:將所有參數重設為其預設值
下列
reset-db-cluster-parameter-group
範例會將客戶建立的資料庫叢集參數群組中的所有參數值重設為其預設值。aws rds reset-db-cluster-parameter-group \ --db-cluster-parameter-group-name
mydbclpg
\ --reset-all-parameters輸出:
{ "DBClusterParameterGroupName": "mydbclpg" }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的使用資料庫參數群組和資料庫叢集參數群組。
範例 2:將特定參數重設為其預設值
下列
reset-db-cluster-parameter-group
範例會將特定參數的參數值重設為客戶建立的資料庫叢集參數群組中的預設值。aws rds reset-db-cluster-parameter-group \ --db-cluster-parameter-group-name
mydbclpgy
\ --parameters"ParameterName=max_connections,ApplyMethod=immediate"
\"ParameterName=max_allowed_packet,ApplyMethod=immediate"
輸出:
{ "DBClusterParameterGroupName": "mydbclpg" }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 ResetDbClusterParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 reset-db-parameter-group
。
- AWS CLI
-
範例 1:將所有參數重設為其預設值
下列
reset-db-parameter-group
範例會將客戶建立的資料庫參數群組中的所有參數值重設為其預設值。aws rds reset-db-parameter-group \ --db-parameter-group-name
mypg
\ --reset-all-parameters輸出:
{ "DBParameterGroupName": "mypg" }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的使用資料庫參數群組,以及 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
範例 2:將特定參數重設為其預設值
下列
reset-db-parameter-group
範例會將特定參數的參數值重設為客戶建立的資料庫參數群組中的預設值。aws rds reset-db-parameter-group \ --db-parameter-group-name
mypg
\ --parameters"ParameterName=max_connections,ApplyMethod=immediate"
\"ParameterName=max_allowed_packet,ApplyMethod=immediate"
輸出:
{ "DBParameterGroupName": "mypg" }
如需詳細資訊,請參閱 Amazon RDS使用者指南中的使用資料庫參數群組,以及 Amazon Aurora 使用者指南 中的使用資料庫參數群組和資料庫叢集參數群組。
-
如需API詳細資訊,請參閱 命令參考 ResetDbParameterGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 restore-db-cluster-from-s3
。
- AWS CLI
-
從 Amazon S3 還原 Amazon Aurora 資料庫叢集
下列
restore-db-cluster-from-s3
範例會從 Amazon S3 中的 MySQL 5.7 資料庫備份檔案還原與 Amazon Aurora MySQL 5.7 版相容的資料庫叢集。 Amazon S3aws rds restore-db-cluster-from-s3 \ --db-cluster-identifier
cluster-s3-restore
\ --engineaurora-mysql
\ --master-usernameadmin
\ --master-user-passwordmypassword
\ --s3-bucket-namemybucket
\ --s3-prefixtest-backup
\ --s3-ingestion-role-arnarn:aws:iam::123456789012:role/service-role/TestBackup
\ --source-enginemysql
\ --source-engine-version5.7.28
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-west-2c", "us-west-2a", "us-west-2b" ], "BackupRetentionPeriod": 1, "DBClusterIdentifier": "cluster-s3-restore", "DBClusterParameterGroup": "default.aurora-mysql5.7", "DBSubnetGroup": "default", "Status": "creating", "Endpoint": "cluster-s3-restore.cluster-co3xyzabc123.us-west-2.rds.amazonaws.com", "ReaderEndpoint": "cluster-s3-restore.cluster-ro-co3xyzabc123.us-west-2.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora-mysql", "EngineVersion": "5.7.12", "Port": 3306, "MasterUsername": "admin", "PreferredBackupWindow": "11:15-11:45", "PreferredMaintenanceWindow": "thu:12:19-thu:12:49", "ReadReplicaIdentifiers": [], "DBClusterMembers": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-########", "Status": "active" } ], "HostedZoneId": "Z1PVIF0EXAMPLE", "StorageEncrypted": false, "DbClusterResourceId": "cluster-SU5THYQQHOWCXZZDGXREXAMPLE", "DBClusterArn": "arn:aws:rds:us-west-2:123456789012:cluster:cluster-s3-restore", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "ClusterCreateTime": "2020-07-27T14:22:08.095Z", "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false, "CopyTagsToSnapshot": false, "CrossAccountClone": false, "DomainMemberships": [] } }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的使用 Amazon S3 儲存貯體從 MySQL 遷移資料。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 RestoreDbClusterFromS3
。
-
下列程式碼範例示範如何使用 restore-db-cluster-from-snapshot
。
- AWS CLI
-
從快照還原資料庫叢集
下列內容會從名為 的資料庫叢集快照
restore-db-cluster-from-snapshot
還原與 PostgreSQL 10.7 版相容的 Aurora PostgreSQL 資料庫叢集test-instance-snapshot
。aws rds restore-db-cluster-from-snapshot \ --db-cluster-identifier
newdbcluster
\ --snapshot-identifiertest-instance-snapshot
\ --engineaurora-postgresql
\ --engine-version10.7
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-west-2c", "us-west-2a", "us-west-2b" ], "BackupRetentionPeriod": 7, "DatabaseName": "", "DBClusterIdentifier": "newdbcluster", "DBClusterParameterGroup": "default.aurora-postgresql10", "DBSubnetGroup": "default", "Status": "creating", "Endpoint": "newdbcluster.cluster-############.us-west-2.rds.amazonaws.com", "ReaderEndpoint": "newdbcluster.cluster-ro-############.us-west-2.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora-postgresql", "EngineVersion": "10.7", "Port": 5432, "MasterUsername": "postgres", "PreferredBackupWindow": "09:33-10:03", "PreferredMaintenanceWindow": "sun:12:22-sun:12:52", "ReadReplicaIdentifiers": [], "DBClusterMembers": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-########", "Status": "active" } ], "HostedZoneId": "Z1PVIF0EXAMPLE", "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/287364e4-33e3-4755-a3b0-a1b2c3d4e5f6", "DbClusterResourceId": "cluster-5DSB5IFQDDUVAWOUWM1EXAMPLE", "DBClusterArn": "arn:aws:rds:us-west-2:123456789012:cluster:newdbcluster", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "ClusterCreateTime": "2020-06-05T15:06:58.634Z", "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false, "CopyTagsToSnapshot": false, "CrossAccountClone": false, "DomainMemberships": [] } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的從資料庫叢集快照還原。
-
如需API詳細資訊,請參閱 命令參考 RestoreDbClusterFromSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 restore-db-cluster-to-point-in-time
。
- AWS CLI
-
將資料庫叢集還原至指定的時間
下列
restore-db-cluster-to-point-in-time
範例會將名為 的資料庫叢集還原database-4
至最晚的可能時間。使用copy-on-write
作為還原類型會將新的資料庫叢集還原為來源資料庫叢集的複製。aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier
database-4
\ --db-cluster-identifiersample-cluster-clone
\ --restore-typecopy-on-write
\ --use-latest-restorable-time輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-west-2c", "us-west-2a", "us-west-2b" ], "BackupRetentionPeriod": 7, "DatabaseName": "", "DBClusterIdentifier": "sample-cluster-clone", "DBClusterParameterGroup": "default.aurora-postgresql10", "DBSubnetGroup": "default", "Status": "creating", "Endpoint": "sample-cluster-clone.cluster-############.us-west-2.rds.amazonaws.com", "ReaderEndpoint": "sample-cluster-clone.cluster-ro-############.us-west-2.rds.amazonaws.com", "MultiAZ": false, "Engine": "aurora-postgresql", "EngineVersion": "10.7", "Port": 5432, "MasterUsername": "postgres", "PreferredBackupWindow": "09:33-10:03", "PreferredMaintenanceWindow": "sun:12:22-sun:12:52", "ReadReplicaIdentifiers": [], "DBClusterMembers": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-########", "Status": "active" } ], "HostedZoneId": "Z1PVIF0EXAMPLE", "StorageEncrypted": true, "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/287364e4-33e3-4755-a3b0-a1b2c3d4e5f6", "DbClusterResourceId": "cluster-BIZ77GDSA2XBSTNPFW1EXAMPLE", "DBClusterArn": "arn:aws:rds:us-west-2:123456789012:cluster:sample-cluster-clone", "AssociatedRoles": [], "IAMDatabaseAuthenticationEnabled": false, "CloneGroupId": "8d19331a-099a-45a4-b4aa-11aa22bb33cc44dd", "ClusterCreateTime": "2020-03-10T19:57:38.967Z", "EngineMode": "provisioned", "DeletionProtection": false, "HttpEndpointEnabled": false, "CopyTagsToSnapshot": false, "CrossAccountClone": false } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的將資料庫叢集還原至指定時間。
-
如需API詳細資訊,請參閱 命令參考 RestoreDbClusterToPointInTime
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 restore-db-instance-from-db-snapshot
。
- AWS CLI
-
從資料庫快照還原資料庫執行個體
下列
restore-db-instance-from-db-snapshot
範例會從指定的資料庫快照建立名為db7-new-instance
db.t3.small
資料庫執行個體類別的新資料庫執行個體。擷取快照的來源資料庫執行個體使用已棄用資料庫執行個體類別,因此您無法將其升級。aws rds restore-db-instance-from-db-snapshot \ --db-instance-identifier
db7-new-instance
\ --db-snapshot-identifierdb7-test-snapshot
\ --db-instance-classdb.t3.small
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "db7-new-instance", "DBInstanceClass": "db.t3.small", "Engine": "mysql", "DBInstanceStatus": "creating", ...output omitted... "PreferredMaintenanceWindow": "mon:07:37-mon:08:07", "PendingModifiedValues": {}, "MultiAZ": false, "EngineVersion": "5.7.22", "AutoMinorVersionUpgrade": true, "ReadReplicaDBInstanceIdentifiers": [], "LicenseModel": "general-public-license", ...output omitted... "DBInstanceArn": "arn:aws:rds:us-west-2:123456789012:db:db7-new-instance", "IAMDatabaseAuthenticationEnabled": false, "PerformanceInsightsEnabled": false, "DeletionProtection": false, "AssociatedRoles": [] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的從資料庫快照還原。
-
如需API詳細資訊,請參閱 命令參考 RestoreDbInstanceFromDbSnapshot
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 restore-db-instance-from-s3
。
- AWS CLI
-
從 Amazon S3 中的備份還原資料庫執行個體
下列
restore-db-instance-from-s3
範例restored-test-instance
會從my-backups
S3 儲存貯體中的現有備份建立名為 的新資料庫執行個體。aws rds restore-db-instance-from-s3 \ --db-instance-identifier
restored-test-instance
\ --allocated-storage250
--db-instance-classdb.m4.large
--enginemysql
\ --master
-username master --master-user-passwordsecret99
\ --s3-bucket-namemy-backups
--s3-ingestion-role-arnarn:aws:iam::123456789012:role/my-role
\ --source-enginemysql
--source-engine-version5.6.27
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 RestoreDbInstanceFromS3
。
-
下列程式碼範例示範如何使用 restore-db-instance-to-point-in-time
。
- AWS CLI
-
範例 1:將資料庫執行個體還原至某個時間點
下列
restore-db-instance-to-point-in-time
範例restored-test-instance
會在指定時間還原test-instance
至名為 的新資料庫執行個體。aws rds restore-db-instance-to-point-in-time \ --source-db-instance-identifier
test-instance
\ --target-db-instancerestored-test-instance
\ --restore-time2018-07-30T23:45:00.000Z
輸出:
{ "DBInstance": { "AllocatedStorage": 20, "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:restored-test-instance", "DBInstanceStatus": "creating", "DBInstanceIdentifier": "restored-test-instance", ...some output omitted... } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的將資料庫執行個體還原至指定的時間。
範例 2:從複寫備份將資料庫執行個體還原至指定的時間
下列
restore-db-instance-to-point-in-time
範例會從複寫的自動備份將 Oracle 資料庫執行個體還原至指定的時間。aws rds restore-db-instance-to-point-in-time \ --source-db-instance-automated-backups-arn
"arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example"
\ --target-db-instance-identifiermyorclinstance-from-replicated-backup
\ --restore-time2020-12-08T18:45:00.000Z
輸出:
{ "DBInstance": { "DBInstanceIdentifier": "myorclinstance-from-replicated-backup", "DBInstanceClass": "db.t3.micro", "Engine": "oracle-se2", "DBInstanceStatus": "creating", "MasterUsername": "admin", "DBName": "ORCL", "AllocatedStorage": 20, "PreferredBackupWindow": "07:45-08:15", "BackupRetentionPeriod": 14, ... some output omitted ... "DbiResourceId": "db-KGLXG75BGVIWKQT7NQ4EXAMPLE", "CACertificateIdentifier": "rds-ca-2019", "DomainMemberships": [], "CopyTagsToSnapshot": false, "MonitoringInterval": 0, "DBInstanceArn": "arn:aws:rds:us-west-2:123456789012:db:myorclinstance-from-replicated-backup", "IAMDatabaseAuthenticationEnabled": false, "PerformanceInsightsEnabled": false, "DeletionProtection": false, "AssociatedRoles": [], "TagList": [] } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的從複寫備份還原至指定時間。
-
如需API詳細資訊,請參閱 命令參考 RestoreDbInstanceToPointInTime
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-activity-stream
。
- AWS CLI
-
啟動資料庫活動串流
下列
start-activity-stream
範例會啟動非同步活動串流,以監控名為 的 Aurora 叢集 my-pg-cluster。aws rds start-activity-stream \ --region
us-east-1
\ --modeasync
\ --kms-key-idarn:aws:kms:us-east-1:1234567890123:key/a12c345d-6ef7-890g-h123-456i789jk0l1
\ --resource-arnarn:aws:rds:us-east-1:1234567890123:cluster:my-pg-cluster
\ --apply-immediately輸出:
{ "KmsKeyId": "arn:aws:kms:us-east-1:1234567890123:key/a12c345d-6ef7-890g-h123-456i789jk0l1", "KinesisStreamName": "aws-rds-das-cluster-0ABCDEFGHI1JKLM2NOPQ3R4S", "Status": "starting", "Mode": "async", "ApplyImmediately": true }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的啟動資料庫活動串流。
-
如需API詳細資訊,請參閱 命令參考 StartActivityStream
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-db-cluster
。
- AWS CLI
-
若要啟動資料庫叢集
下列
start-db-cluster
範例會啟動資料庫叢集及其資料庫執行個體。aws rds start-db-cluster \ --db-cluster-identifier
mydbcluster
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-east-1a", "us-east-1e", "us-east-1b" ], "BackupRetentionPeriod": 1, "DatabaseName": "mydb", "DBClusterIdentifier": "mydbcluster", ...some output truncated... } }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的停止和啟動 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 StartDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-db-instance-automated-backups-replication
。
- AWS CLI
-
若要啟用跨區域自動備份
下列
start-db-instance-automated-backups-replication
範例會將美國東部 (維吉尼亞北部) 區域中的資料庫執行個體自動備份複寫至美國西部 (奧勒岡)。備份保留期為 14 天。aws rds start-db-instance-automated-backups-replication \ --region
us-west-2
\ --source-db-instance-arn"arn:aws:rds:us-east-1:123456789012:db:new-orcl-db"
\ --backup-retention-period14
輸出:
{ "DBInstanceAutomatedBackup": { "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:new-orcl-db", "DbiResourceId": "db-JKIB2GFQ5RV7REPLZA4EXAMPLE", "Region": "us-east-1", "DBInstanceIdentifier": "new-orcl-db", "RestoreWindow": {}, "AllocatedStorage": 20, "Status": "pending", "Port": 1521, "InstanceCreateTime": "2020-12-04T15:28:31Z", "MasterUsername": "admin", "Engine": "oracle-se2", "EngineVersion": "12.1.0.2.v21", "LicenseModel": "bring-your-own-license", "OptionGroupName": "default:oracle-se2-12-1", "Encrypted": false, "StorageType": "gp2", "IAMDatabaseAuthenticationEnabled": false, "BackupRetentionPeriod": 14, "DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的啟用跨區域自動備份。
-
如需API詳細資訊,請參閱 命令參考 StartDbInstanceAutomatedBackupsReplication
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-db-instance
。
- AWS CLI
-
啟動資料庫執行個體
下列
start-db-instance
範例會啟動指定的資料庫執行個體。aws rds start-db-instance \ --db-instance-identifier
test-instance
輸出:
{ "DBInstance": { "DBInstanceStatus": "starting", ...some output truncated... } }
-
如需API詳細資訊,請參閱 命令參考 StartDbInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-export-task
。
- AWS CLI
-
將快照匯出至 Amazon S3
下列
start-export-task
範例會將名為 的資料庫快照匯出db5-snapshot-test
至名為 的 Amazon S3 儲存貯體mybucket
。aws rds start-export-task \ --export-task-identifier
my-s3-export
\ --source-arnarn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test
\ --s3-bucket-namemybucket
\ --iam-role-arnarn:aws:iam::123456789012:role/service-role/ExportRole
\ --kms-key-idarn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff
輸出:
{ "ExportTaskIdentifier": "my-s3-export", "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test", "SnapshotTime": "2020-03-27T20:48:42.023Z", "S3Bucket": "mybucket", "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", "Status": "STARTING", "PercentProgress": 0, "TotalExtractedDataInGB": 0 }
如需詳細資訊,請參閱 Amazon 使用者指南 中的將快照匯出至 Amazon S3 儲存貯體。 RDS
-
如需API詳細資訊,請參閱 命令參考 StartExportTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 stop-activity-stream
。
- AWS CLI
-
停止資料庫活動串流
下列
stop-activity-stream
範例會停止名為 的 Aurora 叢集中的活動串流 my-pg-cluster。aws rds stop-activity-stream \ --region
us-east-1
\ --resource-arnarn:aws:rds:us-east-1:1234567890123:cluster:my-pg-cluster
\ --apply-immediately輸出:
{ "KmsKeyId": "arn:aws:kms:us-east-1:1234567890123:key/a12c345d-6ef7-890g-h123-456i789jk0l1", "KinesisStreamName": "aws-rds-das-cluster-0ABCDEFGHI1JKLM2NOPQ3R4S", "Status": "stopping" }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的停止活動串流。
-
如需API詳細資訊,請參閱 命令參考 StopActivityStream
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 stop-db-cluster
。
- AWS CLI
-
若要停止資料庫叢集
下列
stop-db-cluster
範例會停止資料庫叢集及其資料庫執行個體。aws rds stop-db-cluster \ --db-cluster-identifier
mydbcluster
輸出:
{ "DBCluster": { "AllocatedStorage": 1, "AvailabilityZones": [ "us-east-1a", "us-east-1e", "us-east-1b" ], "BackupRetentionPeriod": 1, "DatabaseName": "mydb", "DBClusterIdentifier": "mydbcluster", ...some output truncated... } }
如需詳細資訊,請參閱Amazon Aurora 使用者指南中的停止和啟動 Amazon Aurora 資料庫叢集。
-
如需API詳細資訊,請參閱 命令參考 StopDbCluster
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 stop-db-instance-automated-backups-replication
。
- AWS CLI
-
停止複寫自動備份
下列
stop-db-instance-automated-backups-replication
結束自動備份複寫至美國西部 (奧勒岡) 區域。複寫的備份會根據設定的備份保留期進行保留。aws rds stop-db-instance-automated-backups-replication \ --region
us-west-2
\ --source-db-instance-arn"arn:aws:rds:us-east-1:123456789012:db:new-orcl-db"
輸出:
{ "DBInstanceAutomatedBackup": { "DBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:new-orcl-db", "DbiResourceId": "db-JKIB2GFQ5RV7REPLZA4EXAMPLE", "Region": "us-east-1", "DBInstanceIdentifier": "new-orcl-db", "RestoreWindow": { "EarliestTime": "2020-12-04T23:13:21.030Z", "LatestTime": "2020-12-07T19:59:57Z" }, "AllocatedStorage": 20, "Status": "replicating", "Port": 1521, "InstanceCreateTime": "2020-12-04T15:28:31Z", "MasterUsername": "admin", "Engine": "oracle-se2", "EngineVersion": "12.1.0.2.v21", "LicenseModel": "bring-your-own-license", "OptionGroupName": "default:oracle-se2-12-1", "Encrypted": false, "StorageType": "gp2", "IAMDatabaseAuthenticationEnabled": false, "BackupRetentionPeriod": 7, "DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-west-2:123456789012:auto-backup:ab-jkib2gfq5rv7replzadausbrktni2bn4example" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的停止自動備份複寫。
-
如需API詳細資訊,請參閱 命令參考 StopDbInstanceAutomatedBackupsReplication
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 stop-db-instance
。
- AWS CLI
-
停止資料庫執行個體
下列
stop-db-instance
範例會停止指定的資料庫執行個體。aws rds stop-db-instance \ --db-instance-identifier
test-instance
輸出:
{ "DBInstance": { "DBInstanceStatus": "stopping", ...some output truncated... } }
-
如需API詳細資訊,請參閱 命令參考 StopDbInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 switchover-blue-green-deployment
。
- AWS CLI
-
範例 1:切換RDS資料庫執行個體的藍/綠部署
下列
switchover-blue-green-deployment
範例會將指定的綠色環境提升為新的生產環境。aws rds switchover-blue-green-deployment \ --blue-green-deployment-identifier
bgd-wi89nwzglccsfake
\ --switchover-timeout300
輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-v53303651eexfake", "BlueGreenDeploymentName": "bgd-cli-test-instance", "Source": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "Target": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-blhi1e", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-green-blhi1e", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-1-green-k5fv7u", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-2-green-ggsh8m", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance-replica-3-green-o2vwm0", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CONFIGURE_BACKUPS", "Status": "COMPLETED" }, { "Name": "CREATING_TOPOLOGY_OF_SOURCE", "Status": "COMPLETED" } ], "Status": "SWITCHOVER_IN_PROGRESS", "CreateTime": "2022-02-25T22:33:22.225000+00:00" } }
如需詳細資訊,請參閱 Amazon RDS使用者指南 中的切換藍/綠部署。
範例 2:提升 Aurora MySQL 資料庫叢集的藍/綠部署
下列
switchover-blue-green-deployment
範例會將指定的綠色環境提升為新的生產環境。aws rds switchover-blue-green-deployment \ --blue-green-deployment-identifier
bgd-wi89nwzglccsfake
\ --switchover-timeout300
輸出:
{ "BlueGreenDeployment": { "BlueGreenDeploymentIdentifier": "bgd-wi89nwzglccsfake", "BlueGreenDeploymentName": "my-blue-green-deployment", "Source": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "Target": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3ud8z6", "SwitchoverDetails": [ { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster:my-aurora-mysql-cluster-green-3ud8z6", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-1-green-bvxc73", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-2-green-7wc4ie", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3", "TargetMember": "arn:aws:rds:us-east-1:123456789012:db:my-aurora-mysql-cluster-3-green-p4xxkz", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-excluded-member-endpoint-green-np1ikl", "Status": "AVAILABLE" }, { "SourceMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint", "TargetMember": "arn:aws:rds:us-east-1:123456789012:cluster-endpoint:my-reader-endpoint-green-miszlf", "Status": "AVAILABLE" } ], "Tasks": [ { "Name": "CREATING_READ_REPLICA_OF_SOURCE", "Status": "COMPLETED" }, { "Name": "DB_ENGINE_VERSION_UPGRADE", "Status": "COMPLETED" }, { "Name": "CREATE_DB_INSTANCES_FOR_CLUSTER", "Status": "COMPLETED" }, { "Name": "CREATE_CUSTOM_ENDPOINTS", "Status": "COMPLETED" } ], "Status": "SWITCHOVER_IN_PROGRESS", "CreateTime": "2022-02-25T22:38:49.522000+00:00" } }
如需詳細資訊,請參閱 Amazon Aurora 使用者指南 中的切換藍/綠部署。
-
如需API詳細資訊,請參閱 命令參考 SwitchoverBlueGreenDeployment
中的 。 AWS CLI
-