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
// 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',
},
],
},
},
});
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"
)
]
)
)
)
// 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();
// 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"
} }
}
}
});
// 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
new Table(scope: Construct, id: string, props: TableProps)
Table(scope: Construct, id: str, props: TableProps)
new Table(Construct scope, String id, TableProps props)
new Table(Construct scope, string id, TableProps props)
NewTable(Scope Construct, Id *string, Props TableProps)
Construct Props
compactionCompactionPropertycompactionCompactionPropertycompactionCompactionPropertyCompactionCompactionPropertyCompactionCompactionProperty= Amazon S3 selects the best compa…#default
Default: Amazon S3 selects the best compaction strategy based on your table sort order.
icebergMetadataIcebergMetadataPropertyiceberg_metadataIcebergMetadataPropertyicebergMetadataIcebergMetadataPropertyIcebergMetadataIcebergMetadataPropertyIcebergMetadataIcebergMetadataProperty= table is created without any met…#default
Default: table is created without any metadata
namespaceINamespacenamespaceINamespacenamespaceINamespaceNamespaceINamespaceNamespaceINamespacerequired#openTableFormatOpenTableFormatopen_table_formatOpenTableFormatopenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatOpenTableFormatrequired#Currently, the only supported value is OpenTableFormat.ICEBERG.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RETAIN#snapshotManagementSnapshotManagementPropertysnapshot_managementSnapshotManagementPropertysnapshotManagementSnapshotManagementPropertySnapshotManagementSnapshotManagementPropertySnapshotManagementSnapshotManagementProperty= enabled: MinimumSnapshots is 1 b…#default
Default: enabled: MinimumSnapshots is 1 by default and MaximumSnapshotAge is 120 hours by default.
storageClassStorageClassstorage_classStorageClassstorageClassStorageClassStorageClassStorageClassStorageClassStorageClass= Inherits from the table bucket's…#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
withoutMetadatabooleanwithout_metadataboolwithoutMetadataBooleanWithoutMetadataboolWithoutMetadata*bool= false#This property is mutually exclusive to 'IcebergMetadata'.
Properties
cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManagerrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#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#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#tablePolicyCfnTablePolicytable_policyCfnTablePolicytablePolicyCfnTablePolicyTablePolicyCfnTablePolicyTablePolicyCfnTablePolicy#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#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)#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)#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#3 parameters
Parameters
scopescopescopescopeScope— The parent creating construct (usuallythis).ididididId— The construct's name.attrsattrsattrsattrsAttrs— ATableAttributesobject 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#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#grantWrite(identity: IGrantable): Grantdef grant_write(self, identity: IGrantable) -> Grantpublic Grant grantWrite(IGrantable identity)public Grant GrantWrite(IGrantable identity)func GrantWrite(Identity IGrantable) Grant#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#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#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#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#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#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#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.