modify_db_snapshot_attribute
async
¶
modify_db_snapshot_attribute(
*,
config_overrides: Optional[AsyncRDSClientConfig] = None,
db_snapshot_identifier: Optional[String] = None,
attribute_name: Optional[String] = None,
values_to_add: Optional[AttributeValueList] = None,
values_to_remove: Optional[AttributeValueList] = None,
) -> ModifyDBSnapshotAttributeResult
Adds an attribute and values to, or removes an attribute and values from, a manual DB snapshot.
To share a manual DB snapshot with other Amazon Web Services accounts, specify restore as the AttributeName and use the ValuesToAdd parameter to add a list of IDs of the Amazon Web Services accounts that are authorized to restore the manual DB snapshot. Uses the value all to make the manual DB snapshot public, which means it can be copied or restored by all Amazon Web Services accounts.
Don't add the all value for any manual DB snapshots that contain private information that you don't want available to all Amazon Web Services accounts.
If the manual DB snapshot is encrypted, it can be shared, but only by specifying a list of authorized Amazon Web Services account IDs for the ValuesToAdd parameter. You can't use all as a value for that parameter in this case.
To view which Amazon Web Services accounts have access to copy or restore a manual DB snapshot, or whether a manual DB snapshot public or private, use the DescribeDBSnapshotAttributes API operation. The accounts are returned as values for the restore attribute.
Parameters:
-
db_snapshot_identifier(Optional[String], default:None) –The identifier for the DB snapshot to modify the attributes for.
-
attribute_name(Optional[String], default:None) –The name of the DB snapshot attribute to modify.
To manage authorization for other Amazon Web Services accounts to copy or restore a manual DB snapshot, set this value to
restore.To view the list of attributes available to modify, use the DescribeDBSnapshotAttributes API operation.
-
values_to_add(Optional[AttributeValueList], default:None) –A list of DB snapshot attributes to add to the attribute specified by
AttributeName.To authorize other Amazon Web Services accounts to copy or restore a manual snapshot, set this list to include one or more Amazon Web Services account IDs, or
allto make the manual DB snapshot restorable by any Amazon Web Services account. Do not add theallvalue for any manual DB snapshots that contain private information that you don't want available to all Amazon Web Services accounts. -
values_to_remove(Optional[AttributeValueList], default:None) –A list of DB snapshot attributes to remove from the attribute specified by
AttributeName.To remove authorization for other Amazon Web Services accounts to copy or restore a manual snapshot, set this list to include one or more Amazon Web Services account identifiers, or
allto remove authorization for any Amazon Web Services account to copy or restore the DB snapshot. If you specifyall, an Amazon Web Services account whose account ID is explicitly added to therestoreattribute can still copy or restore the manual DB snapshot.
Raises:
-
DBSnapshotNotFoundFault–DBSnapshotIdentifierdoesn't refer to an existing DB snapshot. -
InvalidDBSnapshotStateFault–The state of the DB snapshot doesn't allow deletion.
-
SharedSnapshotQuotaExceededFault–You have exceeded the maximum number of accounts that you can share a manual DB snapshot with.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To allow two AWS accounts to restore a DB snapshot The following example grants permission to two AWS accounts, with the identifiers 111122223333 and 444455556666, to restore the DB snapshot named mydbsnapshot.
>>> await client.modify_db_snapshot_attribute(db_snapshot_identifier='mydbsnapshot', attribute_name='restore', values_to_add=['111122223333', '444455556666'])
To prevent an AWS account from restoring a DB snapshot
The following example removes permission from the AWS account with the identifier 444455556666 to restore the DB snapshot named mydbsnapshot.
>>> await client.modify_db_snapshot_attribute(db_snapshot_identifier='mydbsnapshot', attribute_name='restore', values_to_remove=['444455556666'])
Source code in docs_src/capo_rds/_services/async_rds.py
12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 | |