From 509820854327e16ebd27475438c3d0ca0c4cd8e2 Mon Sep 17 00:00:00 2001 From: luigi liu Date: Fri, 30 Oct 2026 13:08:22 -0400 Subject: [PATCH] Check that CLI examples run the command they describe and fix existing violations --- .../examples/gamelift/stop-fleet-actions.rst | 2 +- .../examples/greengrassv2/untag-resource.rst | 2 +- .../iot/add-thing-to-billing-group.rst | 2 +- .../iot/describe-audit-suppression.rst | 32 +-- awscli/examples/iot/update-job.rst | 39 +--- .../kinesis/stop-stream-encryption.rst | 2 +- .../proton/list-service-instances.rst | 31 +-- awscli/examples/rds/create-db-cluster.rst | 81 +++++++ awscli/examples/rds/create-db-instance.rst | 118 ++++++++++- awscli/examples/rds/create-db-shard-group.rst | 199 +----------------- awscli/examples/rds/delete-db-cluster.rst | 12 +- awscli/examples/rds/modify-db-shard-group.rst | 39 +--- ...urchase-reserved-db-instances-offering.rst | 12 +- awscli/examples/rds/reboot-db-shard-group.rst | 39 +--- .../transcribe/delete-medical-vocabulary.rst | 2 +- .../examples/waf-regional/update-ip-set.rst | 2 +- tests/functional/docs/test_examples.py | 41 ++++ 17 files changed, 276 insertions(+), 379 deletions(-) diff --git a/awscli/examples/gamelift/stop-fleet-actions.rst b/awscli/examples/gamelift/stop-fleet-actions.rst index b0ea71c0d2e8..a4d550fcb2a4 100755 --- a/awscli/examples/gamelift/stop-fleet-actions.rst +++ b/awscli/examples/gamelift/stop-fleet-actions.rst @@ -2,7 +2,7 @@ The following ``stop-fleet-actions`` example stops the use of all scaling policies that are defined for the specified fleet. After the policies are suspended, fleet capacity remains at the same active instance count unless you adjust it manually. :: - aws gamelift start-fleet-actions \ + aws gamelift stop-fleet-actions \ --fleet-id fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --actions AUTO_SCALING diff --git a/awscli/examples/greengrassv2/untag-resource.rst b/awscli/examples/greengrassv2/untag-resource.rst index d14b0045bdcf..985b26b9ef53 100644 --- a/awscli/examples/greengrassv2/untag-resource.rst +++ b/awscli/examples/greengrassv2/untag-resource.rst @@ -2,7 +2,7 @@ The following ``untag-resource`` example removes an owner tag from an AWS IoT Greengrass core device. :: - aws iotsitewise untag-resource \ + aws greengrassv2 untag-resource \ --resource-arn arn:aws:greengrass:us-west-2:123456789012:coreDevices:MyGreengrassCore \ --tag-keys Owner diff --git a/awscli/examples/iot/add-thing-to-billing-group.rst b/awscli/examples/iot/add-thing-to-billing-group.rst index a69dfe0622bf..0d03c4a9d6da 100644 --- a/awscli/examples/iot/add-thing-to-billing-group.rst +++ b/awscli/examples/iot/add-thing-to-billing-group.rst @@ -12,7 +12,7 @@ This command produces no output. The following ``add-thing-to-billing-group`` example adds a thing with a specified ARN to a billing group with the specified ARN. Specifying an ARN is helpful if you work with multiple AWS Regions or accounts. It can help ensure that you are adding to the right Region and account. :: - aws iot add-thing-to-thing-group \ + aws iot add-thing-to-billing-group \ --billing-group-arn "arn:aws:iot:us-west-2:123456789012:billinggroup/GroupOne" \ --thing-arn "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb" diff --git a/awscli/examples/iot/describe-audit-suppression.rst b/awscli/examples/iot/describe-audit-suppression.rst index 563f9bf9ef88..e8f1196567db 100644 --- a/awscli/examples/iot/describe-audit-suppression.rst +++ b/awscli/examples/iot/describe-audit-suppression.rst @@ -1,34 +1,20 @@ **To get details about an audit finding suppression** -The following ``describe-audit-suppression`` example lists details about an audit finding suppression. :: +The following ``describe-audit-suppression`` example gets details about the audit finding suppression for an expiring device certificate. :: - aws iot describe-audit-task \ - --task-id "787ed873b69cb4d6cdbae6ddd06996c5" + aws iot describe-audit-suppression \ + --check-name DEVICE_CERTIFICATE_EXPIRING_CHECK \ + --resource-identifier deviceCertificateId=c7691e8b4a5f7d9e8c6b3a2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d Output:: { - "taskStatus": "COMPLETED", - "taskType": "SCHEDULED_AUDIT_TASK", - "taskStartTime": 1596168096.157, - "taskStatistics": { - "totalChecks": 1, - "inProgressChecks": 0, - "waitingForDataCollectionChecks": 0, - "compliantChecks": 0, - "nonCompliantChecks": 1, - "failedChecks": 0, - "canceledChecks": 0 + "checkName": "DEVICE_CERTIFICATE_EXPIRING_CHECK", + "resourceIdentifier": { + "deviceCertificateId": "c7691e8b4a5f7d9e8c6b3a2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d" }, - "scheduledAuditName": "AWSIoTDeviceDefenderDailyAudit", - "auditDetails": { - "DEVICE_CERTIFICATE_EXPIRING_CHECK": { - "checkRunStatus": "COMPLETED_NON_COMPLIANT", - "checkCompliant": false, - "totalResourcesCount": 195, - "nonCompliantResourcesCount": 2 - } - } + "expirationDate": "2020-08-20T00:00:00+00:00", + "suppressIndefinitely": false } For more information, see `Audit finding suppressions `__ in the *AWS IoT Developers Guide*. \ No newline at end of file diff --git a/awscli/examples/iot/update-job.rst b/awscli/examples/iot/update-job.rst index 5235d2f2a647..89ab72677d64 100644 --- a/awscli/examples/iot/update-job.rst +++ b/awscli/examples/iot/update-job.rst @@ -1,38 +1,11 @@ -**To get detailed status for a job** +**To update a job** -The following ``update-job`` example gets detailed status for the job whose ID is ``example-job-01``. :: +The following ``update-job`` example updates the description of the job whose ID is ``example-job-01``. :: - aws iot describe-job \ - --job-id "example-job-01" + aws iot update-job \ + --job-id "example-job-01" \ + --description "example job test" -Output:: - - { - "job": { - "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-01", - "jobId": "example-job-01", - "targetSelection": "SNAPSHOT", - "status": "IN_PROGRESS", - "targets": [ - "arn:aws:iot:us-west-2:123456789012:thing/MyRaspberryPi" - ], - "description": "example job test", - "presignedUrlConfig": {}, - "jobExecutionsRolloutConfig": {}, - "createdAt": 1560787022.733, - "lastUpdatedAt": 1560787026.294, - "jobProcessDetails": { - "numberOfCanceledThings": 0, - "numberOfSucceededThings": 0, - "numberOfFailedThings": 0, - "numberOfRejectedThings": 0, - "numberOfQueuedThings": 1, - "numberOfInProgressThings": 0, - "numberOfRemovedThings": 0, - "numberOfTimedOutThings": 0 - }, - "timeoutConfig": {} - } - } +This command produces no output. For more information, see `Creating and Managing Jobs (CLI) `__ in the *AWS IoT Developer Guide*. diff --git a/awscli/examples/kinesis/stop-stream-encryption.rst b/awscli/examples/kinesis/stop-stream-encryption.rst index 65db99995845..77dd5ce503b5 100644 --- a/awscli/examples/kinesis/stop-stream-encryption.rst +++ b/awscli/examples/kinesis/stop-stream-encryption.rst @@ -2,7 +2,7 @@ The following ``stop-stream-encryption`` example disables server-side encryption for the specified stream, using the specified AWS KMS key. :: - aws kinesis start-stream-encryption \ + aws kinesis stop-stream-encryption \ --encryption-type KMS \ --key-id arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --stream-name samplestream diff --git a/awscli/examples/proton/list-service-instances.rst b/awscli/examples/proton/list-service-instances.rst index 952feecca3f2..0ddff75aca65 100644 --- a/awscli/examples/proton/list-service-instances.rst +++ b/awscli/examples/proton/list-service-instances.rst @@ -1,4 +1,4 @@ -**Example 1: To list all service instances** +**To list all service instances** The following ``list-service-instances`` example lists service instances. :: @@ -25,32 +25,3 @@ Output:: } For more information, see `View service instance data `__ in the *The AWS Proton Administrator Guide* or `View service instance data `__ in the *The AWS Proton User Guide*. - -**Example 2: To list the specified service instance** - -The following ``list-service-instances`` example lists the specified service instance by using the ``get-service-instance`` command, which gets a service instance. :: - - aws proton get-service-instance \ - --name "instance-one" \ - --service-name "simple-svc" - -Output:: - - { - "serviceInstance": { - "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/service-instance/instance-one", - "createdAt": "2020-11-28T22:40:50.512000+00:00", - "deploymentStatus": "SUCCEEDED", - "environmentName": "simple-env", - "lastDeploymentAttemptedAt": "2020-11-28T22:40:50.512000+00:00", - "lastDeploymentSucceededAt": "2020-11-28T22:40:50.512000+00:00", - "name": "instance-one", - "serviceName": "simple-svc", - "spec": "proton: ServiceSpec\npipeline:\n my_sample_pipeline_optional_input: hello world\n my_sample_pipeline_required_input: pipeline up\ninstances:\n- name: instance-one\n environment: my-simple-env\n spec:\n my_sample_service_instance_optional_input: Ola\n my_sample_service_instance_required_input: Ciao\n", - "templateMajorVersion": "1", - "templateMinorVersion": "0", - "templateName": "svc-simple" - } - } - -For more information, see `View service instance data `__ in the *The AWS Proton Administrator Guide* or `View service instance data `__ in the *The AWS Proton User Guide*. diff --git a/awscli/examples/rds/create-db-cluster.rst b/awscli/examples/rds/create-db-cluster.rst index 07f0e20d0c7b..a23439b6b97d 100644 --- a/awscli/examples/rds/create-db-cluster.rst +++ b/awscli/examples/rds/create-db-cluster.rst @@ -183,3 +183,84 @@ Output:: } For more information, see `Creating an Amazon Aurora DB cluster `__ in the *Amazon Aurora User Guide*. + +**Example 4: To create an Aurora PostgreSQL DB cluster for Aurora Limitless Database** + +The following ``create-db-cluster`` example creates an Aurora PostgreSQL primary DB cluster that's compatible with Aurora Serverless v2 and Aurora Limitless Database. After you create the DB cluster, create its writer DB instance with the ``create-db-instance`` command and then a DB shard group with the ``create-db-shard-group`` command. :: + + aws rds create-db-cluster \ + --db-cluster-identifier my-sv2-cluster \ + --engine aurora-postgresql \ + --engine-version 15.2-limitless \ + --storage-type aurora-iopt1 \ + --serverless-v2-scaling-configuration MinCapacity=2,MaxCapacity=16 \ + --enable-limitless-database \ + --master-username myuser \ + --master-user-password mypassword \ + --enable-cloudwatch-logs-exports postgresql + +Output:: + + { + "DBCluster": { + "AllocatedStorage": 1, + "AvailabilityZones": [ + "us-west-2b", + "us-west-2c", + "us-west-2a" + ], + "BackupRetentionPeriod": 1, + "DBClusterIdentifier": "my-sv2-cluster", + "DBClusterParameterGroup": "default.aurora-postgresql15", + "DBSubnetGroup": "default", + "Status": "creating", + "Endpoint": "my-sv2-cluster.cluster-cekycexample.us-west-2.rds.amazonaws.com", + "ReaderEndpoint": "my-sv2-cluster.cluster-ro-cekycexample.us-west-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-west-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 + } + } + } + +For more information, see `Using Aurora Serverless v2 `__ in the *Amazon Aurora User Guide*. diff --git a/awscli/examples/rds/create-db-instance.rst b/awscli/examples/rds/create-db-instance.rst index d43b721c3896..46c8afb49124 100644 --- a/awscli/examples/rds/create-db-instance.rst +++ b/awscli/examples/rds/create-db-instance.rst @@ -1,4 +1,4 @@ -**To create a DB instance** +**Example 1: To create a DB instance** The following ``create-db-instance`` example uses the required options to launch a new DB instance. :: @@ -104,3 +104,119 @@ Output:: } For more information, see `Creating an Amazon RDS DB Instance `__ in the *Amazon RDS User Guide*. + +**Example 2: To create an Aurora Serverless v2 writer DB instance in a DB cluster** + +The following ``create-db-instance`` example creates an Aurora Serverless v2 primary (writer) DB instance in a DB cluster. When you use the console to create a DB cluster, Amazon RDS automatically creates the writer DB instance for your DB cluster. However, when you use the AWS CLI to create a DB cluster, you must explicitly create the writer DB instance for your DB cluster using the ``create-db-instance`` command. :: + + aws rds create-db-instance \ + --db-instance-identifier my-sv2-instance \ + --db-cluster-identifier my-sv2-cluster \ + --engine aurora-postgresql \ + --db-instance-class db.serverless + +Output:: + + { + "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-west-2c" + }, + "SubnetOutpost": {}, + "SubnetStatus": "Active" + }, + { + "SubnetIdentifier": "subnet-########", + "SubnetAvailabilityZone": { + "Name": "us-west-2a" + }, + "SubnetOutpost": {}, + "SubnetStatus": "Active" + }, + { + "SubnetIdentifier": "subnet-########", + "SubnetAvailabilityZone": { + "Name": "us-west-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-west-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 + } + } + +For more information, see `Using Aurora Serverless v2 `__ in the *Amazon Aurora User Guide*. diff --git a/awscli/examples/rds/create-db-shard-group.rst b/awscli/examples/rds/create-db-shard-group.rst index 53d9347c6aa1..3ad7d1b91702 100644 --- a/awscli/examples/rds/create-db-shard-group.rst +++ b/awscli/examples/rds/create-db-shard-group.rst @@ -1,199 +1,6 @@ -**Example 1: To create an Aurora PostgreSQL primary DB cluster** +**To create a DB shard group** -The following ``create-db-shard-group`` example starts by using the ``create-db-cluster`` command to create an Aurora PostgreSQL SQL primary DB cluster that's compatible with Aurora Serverless v2 and Aurora Limitless Database. :: - - aws rds create-db-cluster \ - --db-cluster-identifier my-sv2-cluster \ - --engine aurora-postgresql \ - --engine-version 15.2-limitless \ - --storage-type aurora-iopt1 \ - --serverless-v2-scaling-configuration MinCapacity=2,MaxCapacity=16 \ - --enable-limitless-database \ - --master-username myuser \ - --master-user-password mypassword \ - --enable-cloudwatch-logs-exports postgresql - -Output:: - - { - "DBCluster": { - "AllocatedStorage": 1, - "AvailabilityZones": [ - "us-west-2b", - "us-west-2c", - "us-west-2a" - ], - "BackupRetentionPeriod": 1, - "DBClusterIdentifier": "my-sv2-cluster", - "DBClusterParameterGroup": "default.aurora-postgresql15", - "DBSubnetGroup": "default", - "Status": "creating", - "Endpoint": "my-sv2-cluster.cluster-cekycexample.us-west-2.rds.amazonaws.com", - "ReaderEndpoint": "my-sv2-cluster.cluster-ro-cekycexample.us-west-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-west-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 - } - } - } - -**Example 2: To create the primary (writer) DB instance** - -The following ``create-db-shard-group`` example continues by using the ``create-db-instance`` command to create an Aurora Serverless v2 primary (writer) DB instance. When you use the console to create a DB cluster, Amazon RDS automatically creates the writer DB instance for your DB cluster. However, when you use the AWS CLI to create a DB cluster, you must explicitly create the writer DB instance for your DB cluster using the ``create-db-instance`` AWS CLI command. :: - - aws rds create-db-instance \ - --db-instance-identifier my-sv2-instance \ - --db-cluster-identifier my-sv2-cluster \ - --engine aurora-postgresql \ - --db-instance-class db.serverless - -Output:: - - { - "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-west-2c" - }, - "SubnetOutpost": {}, - "SubnetStatus": "Active" - }, - { - "SubnetIdentifier": "subnet-########", - "SubnetAvailabilityZone": { - "Name": "us-west-2a" - }, - "SubnetOutpost": {}, - "SubnetStatus": "Active" - }, - { - "SubnetIdentifier": "subnet-########", - "SubnetAvailabilityZone": { - "Name": "us-west-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-west-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 - } - } - -**Example 3: To create the DB shard group** - -The following ``create-db-shard-group`` example creates a DB shard group in your Aurora PostgreSQL primary DB cluster. :: +The following ``create-db-shard-group`` example creates a DB shard group in an Aurora PostgreSQL primary DB cluster that's compatible with Aurora Serverless v2 and Aurora Limitless Database. Before you create the DB shard group, create the DB cluster with the ``create-db-cluster`` command and its writer DB instance with the ``create-db-instance`` command. :: aws rds create-db-shard-group \ --db-shard-group-identifier my-db-shard-group \ @@ -213,4 +20,4 @@ Output:: "Endpoint": "my-sv2-cluster.limitless-cekycexample.us-west-2.rds.amazonaws.com" } -For more information, see `Using Aurora Serverless v2 `__ in the *Amazon Aurora User Guide*. \ No newline at end of file +For more information, see `Using Aurora Serverless v2 `__ in the *Amazon Aurora User Guide*. diff --git a/awscli/examples/rds/delete-db-cluster.rst b/awscli/examples/rds/delete-db-cluster.rst index 31da480761f4..d8422622b30c 100644 --- a/awscli/examples/rds/delete-db-cluster.rst +++ b/awscli/examples/rds/delete-db-cluster.rst @@ -1,6 +1,6 @@ -**Example 1: To delete a DB instance in a DB cluster** +**To delete a DB cluster** -The following ``delete-db-cluster`` example starts by using the ``delete-db-instance`` command to delete the final DB instance in a DB cluster. You can't delete a DB cluster if it contains DB instances that aren't in the **deleting** state. You can't take a final snapshot when deleting a DB instance in a DB cluster. :: +The following ``delete-db-cluster`` example deletes the DB cluster named ``mycluster`` and takes a final snapshot named ``mycluster-final-snapshot``. You can't delete a DB cluster if it contains DB instances that aren't in the **deleting** state, so first use the ``delete-db-instance`` command to delete the final DB instance in the DB cluster. You can't take a final snapshot when deleting a DB instance in a DB cluster. :: aws rds delete-db-instance \ --db-instance-identifier database-3 @@ -16,11 +16,7 @@ Output:: } } -For more information, see `Deleting a DB Instance in an Aurora DB Cluster `__ in the *Amazon Aurora User Guide*. - -**Example 2: To delete a DB cluster** - -The following ``delete-db-cluster`` example deletes the DB cluster named ``mycluster`` and takes a final snapshot named ``mycluster-final-snapshot``. The status of the DB cluster is **available** while the snapshot is being taken. To follow the progress of the deletion, use the ``describe-db-clusters`` CLI command. :: +Then delete the DB cluster. The status of the DB cluster is **available** while the snapshot is being taken. To follow the progress of the deletion, use the ``describe-db-clusters`` command. :: aws rds delete-db-cluster \ --db-cluster-identifier mycluster \ @@ -45,4 +41,4 @@ Output:: } } -For more information, see `Aurora Clusters with a Single DB Instance `__ in the *Amazon Aurora User Guide*. \ No newline at end of file +For more information, see `Deleting a DB Instance in an Aurora DB Cluster `__ in the *Amazon Aurora User Guide*. \ No newline at end of file diff --git a/awscli/examples/rds/modify-db-shard-group.rst b/awscli/examples/rds/modify-db-shard-group.rst index 42b368561ec6..fbedafa94c6e 100644 --- a/awscli/examples/rds/modify-db-shard-group.rst +++ b/awscli/examples/rds/modify-db-shard-group.rst @@ -1,6 +1,6 @@ -**Example 1: To modify a DB shard group** +**To modify a DB shard group** -The following ``modify-db-shard-group`` example changes the maximum capacity of a DB shard group. :: +The following ``modify-db-shard-group`` example changes the maximum capacity of a DB shard group to 1000 Aurora capacity units (ACUs). To see the new maximum capacity after the change is applied, use the ``describe-db-shard-groups`` command. :: aws rds modify-db-shard-group \ --db-shard-group-identifier my-db-shard-group \ @@ -20,38 +20,3 @@ Output:: } For more information, see `Amazon Aurora DB Clusters `__ in the *Amazon Aurora User Guide*. - -**Example 2: To describe your DB shard groups** - -The following ``modify-db-shard-group`` example continues by using the ``describe-db-shard-groups`` command to retrieve the details of your DB shard groups after you run the ``modify-db-shard-group`` command. The maximum capacity of the DB shard group ``my-db-shard-group`` is now 1000 Aurora capacity units (ACUs). :: - - aws rds describe-db-shard-groups - -Output:: - - { - "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-west-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-west-2.rds.amazonaws.com" - } - ] - } - -For more information, see `Amazon Aurora DB Clusters `__ in the *Amazon Aurora User Guide*. diff --git a/awscli/examples/rds/purchase-reserved-db-instances-offering.rst b/awscli/examples/rds/purchase-reserved-db-instances-offering.rst index 0469888a0d73..bc1abd5e54ff 100644 --- a/awscli/examples/rds/purchase-reserved-db-instances-offering.rst +++ b/awscli/examples/rds/purchase-reserved-db-instances-offering.rst @@ -1,6 +1,6 @@ -**Example 1: To find a reserved DB instance to purchase** +**To purchase a reserved DB instance** -The following ``purchase-reserved-db-instances-offering`` example starts by using the ``describe-reserved-db-instances-offerings`` command to list the available reserved MySQL DB instances with the db.t2.micro instance class and a duration of one year. The offering ID is required for purchasing a reserved DB instance. :: +The following ``purchase-reserved-db-instances-offering`` example buys a reserved MySQL DB instance with the db.t2.micro instance class and a duration of one year. The offering ID is required for purchasing a reserved DB instance, so first use the ``describe-reserved-db-instances-offerings`` command to find it. :: aws rds describe-reserved-db-instances-offerings \ --product-description mysql \ @@ -31,11 +31,7 @@ Output:: ] } -For more information, see `Reserved DB Instances for Amazon RDS `__ in the *Amazon RDS User Guide*. - -**Example 2: To purchase a reserved DB instance** - -The following ``purchase-reserved-db-instances-offering`` example shows how to buy the reserved DB instance offering from the previous example. :: +Then buy the reserved DB instance offering. :: aws rds purchase-reserved-db-instances-offering \ --reserved-db-instances-offering-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 @@ -67,4 +63,4 @@ Output:: } } -For more information, see `Reserved DB Instances for Amazon RDS `__ in the *Amazon RDS User Guide*. \ No newline at end of file +For more information, see `Reserved DB Instances for Amazon RDS `__ in the *Amazon RDS User Guide*. diff --git a/awscli/examples/rds/reboot-db-shard-group.rst b/awscli/examples/rds/reboot-db-shard-group.rst index 80b7e253bfdb..d5dc787f2281 100644 --- a/awscli/examples/rds/reboot-db-shard-group.rst +++ b/awscli/examples/rds/reboot-db-shard-group.rst @@ -1,6 +1,6 @@ -**Example 1: To reboot a DB shard group** +**To reboot a DB shard group** -The following ``reboot-db-shard-group`` example reboots a DB shard group. :: +The following ``reboot-db-shard-group`` example reboots a DB shard group. To follow the progress of the reboot, use the ``describe-db-shard-groups`` command. :: aws rds reboot-db-shard-group \ --db-shard-group-identifier my-db-shard-group @@ -19,38 +19,3 @@ Output:: } For more information, see `Rebooting an Amazon Aurora DB cluster or Amazon Aurora DB instance `__ in the *Amazon Aurora User Guide*. - -**Example 2: To describe your DB shard groups** - -The following ``reboot-db-shard-group`` example continues by using the ``describe-db-shard-groups`` command to retrieve the details of your DB shard groups after you run the ``reboot-db-shard-group`` command. The DB shard group ``my-db-shard-group`` is now rebooting. :: - - aws rds describe-db-shard-groups - -Output:: - - { - "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-west-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-west-2.rds.amazonaws.com" - } - ] - } - -For more information, see `Rebooting an Amazon Aurora DB cluster or Amazon Aurora DB instance `__ in the *Amazon Aurora User Guide*. \ No newline at end of file diff --git a/awscli/examples/transcribe/delete-medical-vocabulary.rst b/awscli/examples/transcribe/delete-medical-vocabulary.rst index 7e9accfe86dc..e97325f0605b 100644 --- a/awscli/examples/transcribe/delete-medical-vocabulary.rst +++ b/awscli/examples/transcribe/delete-medical-vocabulary.rst @@ -2,7 +2,7 @@ The following ``delete-medical-vocabulary`` example deletes a medical custom vocabulary. For vocabulary-name, specify the name of the medical custom vocabulary. :: - aws transcribe delete-vocabulary \ + aws transcribe delete-medical-vocabulary \ --vocabulary-name medical-custom-vocabulary-name This command produces no output. diff --git a/awscli/examples/waf-regional/update-ip-set.rst b/awscli/examples/waf-regional/update-ip-set.rst index 64283e4cb148..089dd72c1016 100755 --- a/awscli/examples/waf-regional/update-ip-set.rst +++ b/awscli/examples/waf-regional/update-ip-set.rst @@ -2,7 +2,7 @@ The following ``update-ip-set`` example updates an IPSet with an IPv4 address and deletes an IPv6 address. Get the value for ``change-token`` by running the ``get-change-token`` command. Because the value for updates includes embedded double-quotes, you must surround the value with single quotes. :: - aws waf update-ip-set \ + aws waf-regional update-ip-set \ --ip-set-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --change-token 12cs345-67cd-890b-1cd2-c3a4567d89f1 \ --updates 'Action="INSERT",IPSetDescriptor={Type="IPV4",Value="12.34.56.78/16"},Action="DELETE",IPSetDescriptor={Type="IPV6",Value="1111:0000:0000:0000:0000:0000:0000:0111/128"}' diff --git a/tests/functional/docs/test_examples.py b/tests/functional/docs/test_examples.py index 122a95f1913d..fc263300d025 100644 --- a/tests/functional/docs/test_examples.py +++ b/tests/functional/docs/test_examples.py @@ -480,6 +480,40 @@ def check_description(example): return errors +def _command_name(command): + """The command an aws command runs, such as ['ec2', 'wait', 'x'].""" + words = [] + for word in command[0][1][0].split()[1:]: + if word.startswith('-') or word in ('\\', '^', '`'): + break + words.append(word) + return words + + +def check_command_name(example): + # Each example must run the command that its description names, which + # is the command of the file. It can also run other commands, such as + # one that creates a resource first. + path = example.command_path + errors = [] + for section in example.sections: + if section.title is None or not section.commands: + continue + names = [ + _command_name(command)[: len(path)] + for block in section.commands + for command in _split_commands(block) + ] + if path not in names: + block = section.commands[0] + errors.append( + f'Line {block.lineno}: the example must run ' + f'"aws {" ".join(path)}", but it runs ' + f'"aws {" ".join(names[0])}"' + ) + return errors + + def _scan_command_lines(lines): """Split a command block's lines into shell-aware pieces. @@ -1320,6 +1354,13 @@ def test_example_command(example_file): _assert_follows_rule('command', example, errors) +@pytest.mark.parametrize('example_file', STYLE_EXAMPLE_FILES) +def test_example_command_name(example_file): + example = Example(example_file) + errors = check_command_name(example) + _assert_follows_rule('command-name', example, errors) + + @pytest.mark.parametrize('example_file', STYLE_EXAMPLE_FILES) def test_example_file_contents(example_file): example = Example(example_file)