Skip to content
v2.274.0

Experimental

@aws-cdk/aws-s3tables-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

Table L2 construct ​

An S3 Table with helpers.

Example ​

ts
// Build a table with partition spec (minimal configuration)
const partitionedTable = new Table(scope, 'PartitionedTable', {
    tableName: 'partitioned_table',
    namespace: namespace,
    openTableFormat: OpenTableFormat.ICEBERG,
    icebergMetadata: {
        icebergSchema: {
            schemaFieldList: [
                { name: 'event_date', type: 'date', required: true },
                { name: 'event_name', type: 'string' },
            ],
        },
        icebergPartitionSpec: {
            fields: [
                {
                    sourceId: 1,
                    transform: IcebergTransform.IDENTITY,
                    name: 'date_partition',
                },
            ],
        },
    },
});
python
from aws_cdk.aws_s3tables_alpha import IcebergMetadataProperty, IcebergSchemaProperty, SchemaFieldProperty, SchemaFieldProperty, IcebergPartitionSpec, IcebergPartitionField
# Build a table with partition spec (minimal configuration)
partitioned_table = Table(scope, "PartitionedTable",
    table_name="partitioned_table",
    namespace=namespace,
    open_table_format=OpenTableFormat.ICEBERG,
    iceberg_metadata=IcebergMetadataProperty(
        iceberg_schema=IcebergSchemaProperty(
            schema_field_list=[SchemaFieldProperty(name="event_date", type="date", required=True), SchemaFieldProperty(name="event_name", type="string")
            ]
        ),
        iceberg_partition_spec=IcebergPartitionSpec(
            fields=[IcebergPartitionField(
                source_id=1,
                transform=IcebergTransform.IDENTITY,
                name="date_partition"
            )
            ]
        )
    )
)
java
// Build a table with partition spec (minimal configuration)
Table partitionedTable = Table.Builder.create(scope, "PartitionedTable")
        .tableName("partitioned_table")
        .namespace(namespace)
        .openTableFormat(OpenTableFormat.ICEBERG)
        .icebergMetadata(IcebergMetadataProperty.builder()
                .icebergSchema(IcebergSchemaProperty.builder()
                        .schemaFieldList(List.of(SchemaFieldProperty.builder().name("event_date").type("date").required(true).build(), SchemaFieldProperty.builder().name("event_name").type("string").build()))
                        .build())
                .icebergPartitionSpec(IcebergPartitionSpec.builder()
                        .fields(List.of(IcebergPartitionField.builder()
                                .sourceId(1)
                                .transform(IcebergTransform.IDENTITY)
                                .name("date_partition")
                                .build()))
                        .build())
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.S3Tables.Alpha
// Build a table with partition spec (minimal configuration)
var partitionedTable = new Table(scope, "PartitionedTable", new TableProps {
    TableName = "partitioned_table",
    Namespace = namespace,
    OpenTableFormat = OpenTableFormat.ICEBERG,
    IcebergMetadata = new IcebergMetadataProperty {
        IcebergSchema = new IcebergSchemaProperty {
            SchemaFieldList = new [] { new SchemaFieldProperty { Name = "event_date", Type = "date", Required = true }, new SchemaFieldProperty { Name = "event_name", Type = "string" } }
        },
        IcebergPartitionSpec = new IcebergPartitionSpec {
            Fields = new [] { new IcebergPartitionField {
                SourceId = 1,
                Transform = IcebergTransform.IDENTITY,
                Name = "date_partition"
            } }
        }
    }
});
go
// Build a table with partition spec (minimal configuration)
partitionedTable := awscdkawss3tablesalpha.NewTable(*scope, jsii.String("PartitionedTable"), &TableProps{
	TableName: jsii.String("partitioned_table"),
	Namespace: namespace,
	OpenTableFormat: *awscdkawss3tablesalpha.OpenTableFormat_ICEBERG,
	IcebergMetadata: &IcebergMetadataProperty{
		IcebergSchema: &IcebergSchemaProperty{
			SchemaFieldList: []SchemaFieldProperty{
				&SchemaFieldProperty{
					Name: jsii.String("event_date"),
					Type: jsii.String("date"),
					Required: jsii.Boolean(true),
				},
				&SchemaFieldProperty{
					Name: jsii.String("event_name"),
					Type: jsii.String("string"),
				},
			},
		},
		IcebergPartitionSpec: &IcebergPartitionSpec{
			Fields: []IcebergPartitionField{
				&IcebergPartitionField{
					SourceId: jsii.Number(1),
					Transform: *awscdkawss3tablesalpha.IcebergTransform_IDENTITY(),
					Name: jsii.String("date_partition"),
				},
			},
		},
	},
})

Initializer ​

ts
new Table(scope: Construct, id: string, props: TableProps)
python
Table(scope: Construct, id: str, props: TableProps)
java
new Table(Construct scope, String id, TableProps props)
csharp
new Table(Construct scope, string id, TableProps props)
go
NewTable(Scope Construct, Id *string, Props TableProps)

Construct Props ​

compactionCompactionPropertycompactionCompactionPropertycompactionCompactionPropertyCompactionCompactionPropertyCompactionCompactionProperty= Amazon S3 selects the best compa…#
Settings governing the Compaction maintenance action.
default

Default: Amazon S3 selects the best compaction strategy based on your table sort order.

icebergMetadataIcebergMetadataPropertyiceberg_metadataIcebergMetadataPropertyicebergMetadataIcebergMetadataPropertyIcebergMetadataIcebergMetadataPropertyIcebergMetadataIcebergMetadataProperty= table is created without any met…#
Contains details about the metadata for an Iceberg table.
default

Default: table is created without any metadata

namespaceINamespacenamespaceINamespacenamespaceINamespaceNamespaceINamespaceNamespaceINamespacerequired#
The namespace under which this table is created.
openTableFormatOpenTableFormatopen_table_formatOpenTableFormatopenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatrequired#
Format of this table.

Currently, the only supported value is OpenTableFormat.ICEBERG.

removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RETAIN#
Controls what happens to this table it it stoped being managed by cloudformation.
snapshotManagementSnapshotManagementPropertysnapshot_managementSnapshotManagementPropertysnapshotManagementSnapshotManagementPropertySnapshotManagementSnapshotManagementPropertySnapshotManagementSnapshotManagementProperty= enabled: MinimumSnapshots is 1 b…#
Contains details about the snapshot management settings for an Iceberg table.
default

Default: enabled: MinimumSnapshots is 1 by default and MaximumSnapshotAge is 120 hours by default.

storageClassStorageClassstorage_classStorageClassstorageClassStorageClassStorageClassStorageClassStorageClassStorageClass= Inherits from the table bucket's…#
The storage class for the table.

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

Note: This is a create-only property and cannot be changed after the table is created.

default

Default: Inherits from the table bucket's storage class configuration

tableNamestringtable_namestrtableNameStringTableNamestringTableName*stringrequired#
Name of this table, unique within the namespace.
withoutMetadatabooleanwithout_metadataboolwithoutMetadataBooleanWithoutMetadataboolWithoutMetadata*bool= false#
If true, indicates that you don't want to specify a schema for the table.

This property is mutually exclusive to 'IcebergMetadata'.

Properties ​

cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManagerrequired#
The tag manager for this resource.
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.

namespaceINamespacenamespaceINamespacenamespaceINamespaceNamespaceINamespaceNamespaceINamespacerequired#
The namespace containing this table.
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.
tableArnstringtable_arnstrtableArnStringTableArnstringTableArn*stringrequired#
The unique Amazon Resource Name (arn) of this table.
tableNamestringtable_namestrtableNameStringTableNamestringTableName*stringrequired#
The name of this table.
tablePolicyCfnTablePolicytable_policyCfnTablePolicytablePolicyCfnTablePolicyTablePolicyCfnTablePolicyTablePolicyCfnTablePolicy#
The resource policy for this table.

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

Note that the policy statement may or may not be added to the policy. For example, when an ITable is created from an existing table, it's not possible to tell whether the table 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.

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

fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable@staticmethod def from_table_attributes(scope: Construct, id: str, attrs: TableAttributes) -> ITablepublic static ITable fromTableAttributes(Construct scope, String id, TableAttributes attrs)public static ITable FromTableAttributes(Construct scope, string id, TableAttributes attrs)func FromTableAttributes(Scope Construct, Id *string, Attrs TableAttributes) ITablestatic#
Defines a Table construct that represents an external table.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • attrsattrsattrsattrsAttrs — A TableAttributes object containing the table name and ARN.
grantRead(identity: IGrantable): Grantdef grant_read(self, identity: IGrantable) -> Grantpublic Grant grantRead(IGrantable identity)public Grant GrantRead(IGrantable identity)func GrantRead(Identity IGrantable) Grant#
[disable-awslint:no-grants].
grantReadWrite(identity: IGrantable): Grantdef grant_read_write(self, identity: IGrantable) -> Grantpublic Grant grantReadWrite(IGrantable identity)public Grant GrantReadWrite(IGrantable identity)func GrantReadWrite(Identity IGrantable) Grant#
[disable-awslint:no-grants].
grantWrite(identity: IGrantable): Grantdef grant_write(self, identity: IGrantable) -> Grantpublic Grant grantWrite(IGrantable identity)public Grant GrantWrite(IGrantable identity)func GrantWrite(Identity IGrantable) 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.
validateTableName(tableName: string): void@staticmethod def validate_table_name(table_name: str) -> Nonepublic static void validateTableName(String tableName)public static void ValidateTableName(string tableName)func ValidateTableName(TableName *string)static#
See https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-buckets-naming.html.
1 parameter

Parameters

  • tableNametable_nametableNametableNameTableName — Name of the table.
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.