modify_db_snapshot_attribute
¶
modify_db_snapshot_attribute(
*,
config_overrides: Optional[RDSClientConfig] = 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.
>>> 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.
>>> client.modify_db_snapshot_attribute(db_snapshot_identifier='mydbsnapshot', attribute_name='restore', values_to_remove=['444455556666'])
Source code in docs_src/capo_rds/_services/rds.py
11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 | |