Skip to content
v2.277.0

ImportSourceSpecification Struct ​

Properties for importing data from the S3.

Example ​

ts
import * as cdk from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');

declare const bucket: s3.IBucket;

new dynamodb.Table(stack, 'Table', {
  partitionKey: {
    name: 'id',
    type: dynamodb.AttributeType.STRING,
  },
  importSource: {
    compressionType: dynamodb.InputCompressionType.GZIP,
    inputFormat: dynamodb.InputFormat.dynamoDBJson(),
    bucket,
    keyPrefix: 'prefix',
  },
});
python
import aws_cdk as cdk
import aws_cdk.aws_s3 as s3

# bucket: s3.IBucket


app = cdk.App()
stack = cdk.Stack(app, "Stack")

dynamodb.Table(stack, "Table",
    partition_key=dynamodb.Attribute(
        name="id",
        type=dynamodb.AttributeType.STRING
    ),
    import_source=dynamodb.ImportSourceSpecification(
        compression_type=dynamodb.InputCompressionType.GZIP,
        input_format=dynamodb.InputFormat.dynamo_db_json(),
        bucket=bucket,
        key_prefix="prefix"
    )
)
java
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.s3.*;

IBucket bucket;


App app = new App();
Stack stack = new Stack(app, "Stack");

Table.Builder.create(stack, "Table")
        .partitionKey(Attribute.builder()
                .name("id")
                .type(AttributeType.STRING)
                .build())
        .importSource(ImportSourceSpecification.builder()
                .compressionType(InputCompressionType.GZIP)
                .inputFormat(InputFormat.dynamoDBJson())
                .bucket(bucket)
                .keyPrefix("prefix")
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK;
using Amazon.CDK.AWS.S3;

IBucket bucket;


var app = new App();
var stack = new Stack(app, "Stack");

new Table(stack, "Table", new TableProps {
    PartitionKey = new Attribute {
        Name = "id",
        Type = AttributeType.STRING
    },
    ImportSource = new ImportSourceSpecification {
        CompressionType = InputCompressionType.GZIP,
        InputFormat = InputFormat.DynamoDBJson(),
        Bucket = bucket,
        KeyPrefix = "prefix"
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import s3 "github.com/aws/aws-cdk-go/awscdk"

var bucket IBucket


app := cdk.NewApp()
stack := cdk.NewStack(app, jsii.String("Stack"))

dynamodb.NewTable(stack, jsii.String("Table"), &TableProps{
	PartitionKey: &Attribute{
		Name: jsii.String("id"),
		Type: dynamodb.AttributeType_STRING,
	},
	ImportSource: &ImportSourceSpecification{
		CompressionType: dynamodb.InputCompressionType_GZIP,
		InputFormat: dynamodb.InputFormat_DynamoDBJson(),
		Bucket: *Bucket,
		KeyPrefix: jsii.String("prefix"),
	},
})

Properties ​

bucketIBucketbucketIBucketbucketIBucketBucketIBucketBucketIBucketrequired#
The S3 bucket that is being imported from.
bucketOwneroptionalstringbucket_owneroptionalstrbucketOwneroptionalStringBucketOwneroptionalstringBucketOwneroptional*string#
The account number of the S3 bucket that is being imported from.

Default: no value

compressionTypeoptionalInputCompressionTypecompression_typeoptionalInputCompressionTypecompressionTypeoptionalInputCompressionTypeCompressionTypeoptionalInputCompressionTypeCompressionTypeoptionalInputCompressionType= InputCompressionType.NONE#
The compression type of the imported data.
inputFormatInputFormatinput_formatInputFormatinputFormatInputFormatInputFormatInputFormatInputFormatInputFormatrequired#
The format of the imported data.
keyPrefixoptionalstringkey_prefixoptionalstrkeyPrefixoptionalStringKeyPrefixoptionalstringKeyPrefixoptional*string#
The key prefix shared by all S3 Objects that are being imported.

Default: no value