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
12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 | |