{"id":9525,"library":"aws-cdk-aws-s3tables-alpha","title":"AWS CDK S3 Tables Alpha","description":"The `aws-cdk-aws-s3tables-alpha` module provides AWS CDK constructs for defining S3-backed tables, integrating with AWS Glue Data Catalog and allowing querying via services like Amazon Athena. As an 'alpha' module within the AWS CDK v2 ecosystem (current version 2.250.0a0), it offers early access to features, with a rapid release cadence that may include frequent breaking changes.","status":"active","version":"2.250.0a0","language":"en","source_language":"en","source_url":"https://github.com/aws/aws-cdk.git","tags":["aws","cdk","s3","glue","athena","data-lake","iac","cloud","serverless"],"install":[{"cmd":"pip install aws-cdk-aws-s3tables-alpha aws-cdk-lib constructs","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core AWS CDK v2 library, required for all CDK applications.","package":"aws-cdk-lib"},{"reason":"Foundation library for constructing and composing AWS CDK applications.","package":"constructs"}],"imports":[{"symbol":"S3Table","correct":"from aws_cdk_aws_s3tables_alpha import S3Table"},{"symbol":"TableOptions","correct":"from aws_cdk_aws_s3tables_alpha import TableOptions"},{"symbol":"DataFormat","correct":"from aws_cdk_aws_s3tables_alpha import DataFormat"},{"symbol":"Column","correct":"from aws_cdk_aws_s3tables_alpha import Column"},{"note":"CDK v2 imports AWS service modules as `aws_service` directly from `aws_cdk`.","wrong":"import aws_cdk.aws_s3 as s3","symbol":"aws_s3 as s3","correct":"from aws_cdk import aws_s3 as s3"}],"quickstart":{"code":"import os\nfrom aws_cdk import App, Stack, Environment, aws_s3 as s3\nfrom aws_cdk.aws_s3 import Bucket, RemovalPolicy\nfrom aws_cdk_aws_s3tables_alpha import S3Table, TableOptions, DataFormat, Column\n\nclass MyS3TableStack(Stack):\n    def __init__(self, scope: App, id: str, **kwargs) -> None:\n        super().__init__(scope, id, **kwargs)\n\n        # Define an S3 Bucket to store the table data\n        # In production, use RemovalPolicy.RETAIN and consider bucket versioning\n        data_bucket = Bucket(self, \"MyDataLakeBucket\",\n            versioned=True,\n            removal_policy=RemovalPolicy.DESTROY # CAUTION: Deletes bucket and contents on stack delete\n        )\n\n        # Define the S3 Table construct, creating a Glue Table\n        s3_glue_table = S3Table(self, \"MyProductSalesS3Table\",\n            bucket=data_bucket,\n            table_name=\"product_sales\",\n            database_name=\"sales_data_db\", # The AWS Glue database name\n            table_options=TableOptions(\n                data_format=DataFormat.PARQUET, # Common for data lakes\n                columns=[\n                    Column(name=\"product_id\", type=\"string\"),\n                    Column(name=\"sale_date\", type=\"date\"),\n                    Column(name=\"amount\", type=\"double\"),\n                    Column(name=\"region\", type=\"string\")\n                ],\n            ),\n            # Example: Partition by year and month for efficient querying\n            # partition_keys=[\n            #     Column(name=\"year\", type=\"string\"),\n            #     Column(name=\"month\", type=\"string\")\n            # ]\n        )\n\n        # You can access properties like table_name or database_name\n        # CfnOutput(self, \"S3BucketName\", value=data_bucket.bucket_name)\n        # CfnOutput(self, \"GlueTableName\", value=s3_glue_table.table_name)\n\n# Standard CDK application entry point\napp = App()\nMyS3TableStack(app, \"MyS3TableStack\",\n    env=Environment(\n        account=os.environ.get(\"CDK_DEFAULT_ACCOUNT\"),\n        region=os.environ.get(\"CDK_DEFAULT_REGION\")\n    )\n)\napp.synth()","lang":"python","description":"This quickstart demonstrates how to create an S3 bucket and then define an S3-backed Glue Data Catalog table using `S3Table`. The table is configured with a PARQUET data format and several columns. Replace placeholder values like `product_sales` and `sales_data_db` with your specific requirements. This code synthesizes a CDK CloudFormation template."},"warnings":[{"fix":"Pin your module versions (e.g., `aws-cdk-aws-s3tables-alpha==2.250.0a0`) and review changelogs or module-specific READMEs carefully before upgrading. Be prepared to refactor code when updating.","message":"This is an ALPHA module. Stability is not guaranteed. Breaking changes can and do occur frequently, even between minor versions. Always consult the latest module documentation before updating.","severity":"breaking","affected_versions":"All versions with 'a' or 'alpha' suffix"},{"fix":"Ensure all CDK imports follow the v2 pattern (e.g., `from aws_cdk import aws_s3 as s3`). If migrating from v1, consult the CDK v1 to v2 migration guide.","message":"CDK v1 vs. v2 import paths: This module is exclusively for AWS CDK v2. Trying to import `aws_cdk` components in the v1 style (e.g., `import aws_cdk.aws_s3`) will lead to `ModuleNotFoundError` or other incompatibilities if using CDK v2.","severity":"gotcha","affected_versions":"All CDK v2 versions"},{"fix":"Verify that the IAM role associated with your CDK deployment (e.g., `cdk deploy`) has policies like `AWSGlueConsoleFullAccess` (for development) or more granular `glue:CreateDatabase`, `glue:CreateTable`, `s3:GetObject`, `s3:PutObject` permissions for production environments.","message":"The `S3Table` construct creates AWS Glue Data Catalog tables. Ensure your CDK deployment role has sufficient IAM permissions to create, update, and delete Glue databases and tables, as well as S3 bucket permissions for the data.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the package: `pip install aws-cdk-aws-s3tables-alpha`.","cause":"The `aws-cdk-aws-s3tables-alpha` Python package has not been installed.","error":"ModuleNotFoundError: No module named 'aws_cdk_aws_s3tables_alpha'"},{"fix":"Ensure `from aws_cdk_aws_s3tables_alpha import DataFormat, Column` is present and that `DataFormat.PARQUET` (or other formats) and `Column(...)` objects are correctly passed to `TableOptions`.","cause":"This error often occurs when `DataFormat` or `Column` are not imported or referenced correctly within the `TableOptions` or `S3Table` definition.","error":"jsii.errors.JavaScriptError: Cannot read properties of undefined (reading 'PARQUET')"},{"fix":"Provide all required properties in the `S3Table` constructor. For example: `S3Table(self, 'Id', bucket=my_bucket, table_name='my-table', database_name='my-database', table_options=...)`.","cause":"Essential properties like `database_name` or `table_name` were omitted when instantiating `S3Table`.","error":"jsii.errors.JavaScriptError: The 'databaseName' property is required for S3Table."}]}