class ImportSource
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CloudFront.ImportSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#ImportSource |
Java | software.amazon.awscdk.services.cloudfront.ImportSource |
Python | aws_cdk.aws_cloudfront.ImportSource |
TypeScript (source) | aws-cdk-lib » aws_cloudfront » ImportSource |
Implemented by
Asset, Inline, S3
The data to be imported to the key value store.
Example
const storeAsset = new cloudfront.KeyValueStore(this, 'KeyValueStoreAsset', {
keyValueStoreName: 'KeyValueStoreAsset',
source: cloudfront.ImportSource.fromAsset('path-to-data.json'),
});
const storeInline = new cloudfront.KeyValueStore(this, 'KeyValueStoreInline', {
keyValueStoreName: 'KeyValueStoreInline',
source: cloudfront.ImportSource.fromInline(JSON.stringify({
data: [
{
key: "key1",
value: "value1",
},
{
key: "key2",
value: "value2",
},
],
})),
});
Initializer
new ImportSource()
Methods
| Name | Description |
|---|---|
| static from | An import source that exists as a local file. |
| static from | An import source that exists as an object in an S3 bucket. |
| static from | An import source that uses an inline string. |
static fromAsset(path, options?)
public static fromAsset(path: string, options?: AssetOptions): ImportSource
Parameters
- path
string— the path to the local file. - options
Asset— the configuration for the temporarily created S3 file.Options
Returns
An import source that exists as a local file.
static fromBucket(bucket, key)
public static fromBucket(bucket: IBucket, key: string): ImportSource
Parameters
- bucket
IBucket— the S3 bucket that contains the data. - key
string— the key within the S3 bucket that contains the data.
Returns
An import source that exists as an object in an S3 bucket.
static fromInline(data)
public static fromInline(data: string): ImportSource
Parameters
- data
string— the contents of the KeyValueStore.
Returns
An import source that uses an inline string.

.NET
Go
Java
Python
TypeScript (