Skip to content
v2.273.0

TableBucket L2 construct ​

An S3 table bucket with helpers for associated resource policies.

This bucket may not yet have all features that exposed by the underlying CfnTableBucket.

Example ​

ts
const sampleTableBucket = new TableBucket(scope, 'ExampleTableBucket', {
  tableBucketName: 'example-bucket',
  // Optional fields:
  unreferencedFileRemoval: {
    noncurrentDays: 123,
    status: UnreferencedFileRemovalStatus.ENABLED,
    unreferencedDays: 123,
  },
});
python
from aws_cdk.aws_s3tables_alpha import UnreferencedFileRemoval
sample_table_bucket = TableBucket(scope, "ExampleTableBucket",
    table_bucket_name="example-bucket",
    # Optional fields:
    unreferenced_file_removal=UnreferencedFileRemoval(
        noncurrent_days=123,
        status=UnreferencedFileRemovalStatus.ENABLED,
        unreferenced_days=123
    )
)
java
TableBucket sampleTableBucket = TableBucket.Builder.create(scope, "ExampleTableBucket")
        .tableBucketName("example-bucket")
        // Optional fields:
        .unreferencedFileRemoval(UnreferencedFileRemoval.builder()
                .noncurrentDays(123)
                .status(UnreferencedFileRemovalStatus.ENABLED)
                .unreferencedDays(123)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.S3Tables.Alpha
var sampleTableBucket = new TableBucket(scope, "ExampleTableBucket", new TableBucketProps {
    TableBucketName = "example-bucket",
    // Optional fields:
    UnreferencedFileRemoval = new UnreferencedFileRemoval {
        NoncurrentDays = 123,
        Status = UnreferencedFileRemovalStatus.ENABLED,
        UnreferencedDays = 123
    }
});
go
sampleTableBucket := awscdkawss3tablesalpha.NewTableBucket(*scope, jsii.String("ExampleTableBucket"), &TableBucketProps{
	TableBucketName: jsii.String("example-bucket"),
	// Optional fields:
	UnreferencedFileRemoval: &UnreferencedFileRemoval{
		NoncurrentDays: jsii.Number(123),
		Status: *awscdkawss3tablesalpha.UnreferencedFileRemovalStatus_ENABLED,
		UnreferencedDays: jsii.Number(123),
	},
})

Initializer ​

ts
new TableBucket(scope: Construct, id: string, props?: TableBucketProps)
python
TableBucket(scope: Construct, id: str, props: typing.Optional[TableBucketProps] = None)
java
new TableBucket(Construct scope, String id, TableBucketProps props)
csharp
new TableBucket(Construct scope, string id, TableBucketProps? props = null)
go
NewTableBucket(Scope Construct, Id *string, Props TableBucketProps)

Construct Props ​

accountstringaccountstraccountStringAccountstringAccount*string= it's assumed the bucket belongs …#
AWS Account ID of the table bucket owner.
default

Default: it's assumed the bucket belongs to the same account as the scope it's being imported into

encryptionTableBucketEncryptionencryptionTableBucketEncryptionencryptionTableBucketEncryptionEncryptionTableBucketEncryptionEncryptionTableBucketEncryption= `KMS` if `encryptionKey` is spec…#
The kind of server-side encryption to apply to this bucket.

If you choose KMS, you can specify a KMS key via encryptionKey. If encryption key is not specified, a key will automatically be created.

default

Default: KMS if encryptionKey is specified, or S3_MANAGED otherwise.

encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey= If `encryption` is set to `KMS` …#
External KMS key to use for bucket encryption.

The encryption property must be either not specified or set to KMS. An error will be emitted if encryption is set to S3_MANAGED.

default

Default: If encryption is set to KMS and this property is undefined, a new KMS key will be created and associated with this bucket.

regionstringregionstrregionStringRegionstringRegion*string= it's assumed the bucket is in th…#
AWS region that the table bucket exists in.
default

Default: it's assumed the bucket is in the same region as the scope it's being imported into

removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RETAIN#
Controls what happens to this table bucket it it stoped being managed by cloudformation.
requestMetricsStatusRequestMetricsStatusrequest_metrics_statusRequestMetricsStatusrequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatus= Request metrics are disabled#
CloudWatch request metrics configuration for the table bucket.

When enabled, S3 Tables publishes CloudWatch request metrics for the table bucket. Request metrics provide insight into Amazon S3 Tables requests.

storageClassStorageClassstorage_classStorageClassstorageClassStorageClassStorageClassStorageClassStorageClassStorageClass= STANDARD storage class#
The storage class for the table bucket.

Determines the storage tier used for table data, allowing optimization for different access patterns and cost profiles.

tableBucketNamestringtable_bucket_namestrtableBucketNameStringTableBucketNamestringTableBucketName*string= generated by CDK from the stack …#
Name of the S3 TableBucket.
default

Default: generated by CDK from the stack and construct path.

unreferencedFileRemovalUnreferencedFileRemovalunreferenced_file_removalUnreferencedFileRemovalunreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemoval= Enabled with default values#
Unreferenced file removal settings for the S3 TableBucket.

Properties ​

cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManagerrequired#
The tag manager for this resource.
encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey#
Optional KMS encryption key associated with this table bucket.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
tableBucketArnstringtable_bucket_arnstrtableBucketArnStringTableBucketArnstringTableBucketArn*stringrequired#
The unique Amazon Resource Name (arn) of this table bucket.
tableBucketNamestringtable_bucket_namestrtableBucketNameStringTableBucketNamestringTableBucketName*stringrequired#
The name of this table bucket.
tableBucketPolicyTableBucketPolicytable_bucket_policyTableBucketPolicytableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicy#
The resource policy for this tableBucket.

Methods ​

addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResultdef add_to_resource_policy(self, statement: PolicyStatement) -> AddToResourcePolicyResultpublic AddToResourcePolicyResult addToResourcePolicy(PolicyStatement statement)public AddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)func AddToResourcePolicy(Statement PolicyStatement) AddToResourcePolicyResult#
Adds a statement to the resource policy for a principal (i.e. account/role/service) to perform actions on this table bucket and/or its contents. Use `tableBucketArn` and `arnForObjects(keys)` to obtain ARNs for this bucket or objects.
notes · 1 parameter · returns

Note that the policy statement may or may not be added to the policy. For example, when an ITableBucket is created from an existing table bucket, it's not possible to tell whether the bucket already has a policy attached, let alone to re-use that policy to add more statements to it. So it's safest to do nothing in these cases.

Parameters

  • statementstatementstatementstatementStatement — the policy statement to be added to the bucket's policy.

Returns: metadata about the execution of this method. If the policy was not added, the value of statementAdded will be false. You should always check this value to make sure that the operation was actually carried out. Otherwise, synthesis and deploy will terminate silently, which may be confusing.

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

fromTableBucketArn(scope: Construct, id: string, tableBucketArn: string): ITableBucket@staticmethod def from_table_bucket_arn(scope: Construct, id: str, table_bucket_arn: str) -> ITableBucketpublic static ITableBucket fromTableBucketArn(Construct scope, String id, String tableBucketArn)public static ITableBucket FromTableBucketArn(Construct scope, string id, string tableBucketArn)func FromTableBucketArn(Scope Construct, Id *string, TableBucketArn *string) ITableBucketstatic#
Defines a TableBucket construct from an external table bucket ARN.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • tableBucketArntable_bucket_arntableBucketArntableBucketArnTableBucketArn — Amazon Resource Name (arn) of the table bucket.
fromTableBucketAttributes(scope: Construct, id: string, attrs: TableBucketAttributes): ITableBucket@staticmethod def from_table_bucket_attributes(scope: Construct, id: str, attrs: TableBucketAttributes) -> ITableBucketpublic static ITableBucket fromTableBucketAttributes(Construct scope, String id, TableBucketAttributes attrs)public static ITableBucket FromTableBucketAttributes(Construct scope, string id, TableBucketAttributes attrs)func FromTableBucketAttributes(Scope Construct, Id *string, Attrs TableBucketAttributes) ITableBucketstatic#
Defines a TableBucket construct that represents an external table bucket.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • attrsattrsattrsattrsAttrs — A TableBucketAttributes object.
grantRead(identity: IGrantable, tableId: string): Grantdef grant_read(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantRead(IGrantable identity, String tableId)public Grant GrantRead(IGrantable identity, string tableId)func GrantRead(Identity IGrantable, TableId *string) Grant#
[disable-awslint:no-grants].
grantReadWrite(identity: IGrantable, tableId: string): Grantdef grant_read_write(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantReadWrite(IGrantable identity, String tableId)public Grant GrantReadWrite(IGrantable identity, string tableId)func GrantReadWrite(Identity IGrantable, TableId *string) Grant#
[disable-awslint:no-grants].
grantWrite(identity: IGrantable, tableId: string): Grantdef grant_write(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantWrite(IGrantable identity, String tableId)public Grant GrantWrite(IGrantable identity, string tableId)func GrantWrite(Identity IGrantable, TableId *string) Grant#
[disable-awslint:no-grants].
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct 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 class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof 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 the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
validateTableBucketName(bucketName?: string): void@staticmethod def validate_table_bucket_name(bucket_name: typing.Optional[str] = None) -> Nonepublic static void validateTableBucketName(String bucketName)public static void ValidateTableBucketName(string? bucketName = null)func ValidateTableBucketName(BucketName *string)static#
Throws an exception if the given table bucket name is not valid.
1 parameter

Parameters

  • bucketNamebucket_namebucketNamebucketNameBucketName — name of the bucket.
validateUnreferencedFileRemoval(unreferencedFileRemoval?: UnreferencedFileRemoval): void@staticmethod def validate_unreferenced_file_removal(unreferenced_file_removal: typing.Optional[UnreferencedFileRemoval] = None) -> Nonepublic static void validateUnreferencedFileRemoval(UnreferencedFileRemoval unreferencedFileRemoval)public static void ValidateUnreferencedFileRemoval(UnreferencedFileRemoval? unreferencedFileRemoval = null)func ValidateUnreferencedFileRemoval(UnreferencedFileRemoval UnreferencedFileRemoval)static#
Throws an exception if the given unreferencedFileRemovalProperty is not valid.
1 parameter

Parameters

  • unreferencedFileRemovalunreferenced_file_removalunreferencedFileRemovalunreferencedFileRemovalUnreferencedFileRemoval — configuration for the table bucket.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.