BackupVault
- class aws_cdk.aws_backup.BackupVault(scope, id, *, access_policy=None, backup_vault_name=None, block_recovery_point_deletion=None, encryption_key=None, lock_configuration=None, notification_events=None, notification_topic=None, removal_policy=None)
Bases:
Resource
A backup vault.
- ExampleMetadata:
infused
Example:
imported_vault = backup.BackupVault.from_backup_vault_name(self, "Vault", "myVaultName") role = iam.Role(self, "Access Role", assumed_by=iam.ServicePrincipal("lambda.amazonaws.com")) imported_vault.grant(role, "backup:StartBackupJob")
- Parameters:
scope (
Construct
) –id (
str
) –access_policy (
Optional
[PolicyDocument
]) – A resource-based policy that is used to manage access permissions on the backup vault. Default: - access is not restrictedbackup_vault_name (
Optional
[str
]) – The name of a logical container where backups are stored. Backup vaults are identified by names that are unique to the account used to create them and the AWS Region where they are created. Default: - A CDK generated nameblock_recovery_point_deletion (
Optional
[bool
]) – Whether to add statements to the vault access policy that prevents anyone from deleting a recovery point. Default: falseencryption_key (
Optional
[IKey
]) – The server-side encryption key to use to protect your backups. Default: - an Amazon managed KMS keylock_configuration (
Union
[LockConfiguration
,Dict
[str
,Any
],None
]) – Configuration for AWS Backup Vault Lock. Default: - AWS Backup Vault Lock is disablednotification_events (
Optional
[Sequence
[BackupVaultEvents
]]) – The vault events to send. Default: - all vault events ifnotificationTopic
is definednotification_topic (
Optional
[ITopic
]) – A SNS topic to send vault events to. Default: - no notificationsremoval_policy (
Optional
[RemovalPolicy
]) – The removal policy to apply to the vault. Note that removing a vault that contains recovery points will fail. Default: RemovalPolicy.RETAIN
Methods
- add_to_access_policy(statement)
Adds a statement to the vault access policy.
- Parameters:
statement (
PolicyStatement
) –- Return type:
None
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- block_recovery_point_deletion()
Adds a statement to the vault access policy that prevents anyone from deleting a recovery point.
- Return type:
None
- grant(grantee, *actions)
Grant the actions defined in actions to the given grantee on this Backup Vault resource.
- Parameters:
grantee (
IGrantable
) – Principal to grant right to.actions (
str
) – The actions to grant.
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- backup_vault_arn
The ARN of the backup vault.
- backup_vault_name
The name of a logical container where backups are stored.
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The tree node.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_backup_vault_arn(scope, id, backup_vault_arn)
Import an existing backup vault by arn.
- Parameters:
scope (
Construct
) –id (
str
) –backup_vault_arn (
str
) –
- Return type:
- classmethod from_backup_vault_name(scope, id, backup_vault_name)
Import an existing backup vault by name.
- Parameters:
scope (
Construct
) –id (
str
) –backup_vault_name (
str
) –
- Return type:
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool