# AssetImportSource

An import source from a local file.

Extends: ImportSource › AssetImportSource

- Source: [`aws-cloudfront/lib/key-value-store.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0/packages/aws-cdk-lib/aws-cloudfront/lib/key-value-store.ts#L86)
- Type last changed: v2.118.0 · 3 Jan 2024

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_kms as interfaces_kms } from 'aws-cdk-lib/interfaces';

declare const dockerImage: cdk.DockerImage;
declare const grantable: iam.IGrantable;
declare const keyRef: interfaces_kms.IKeyRef;
declare const localBundling: cdk.ILocalBundling;
const assetImportSource = cloudfront.AssetImportSource.fromAsset('path', /* all optional props */ {
  assetHash: 'assetHash',
  assetHashType: cdk.AssetHashType.SOURCE,
  bundling: {
    image: dockerImage,

    // the properties below are optional
    bundlingFileAccess: cdk.BundlingFileAccess.VOLUME_COPY,
    command: ['command'],
    entrypoint: ['entrypoint'],
    environment: {
      environmentKey: 'environment',
    },
    local: localBundling,
    network: 'network',
    outputType: cdk.BundlingOutput.ARCHIVED,
    platform: 'platform',
    securityOpt: 'securityOpt',
    user: 'user',
    volumes: [{
      containerPath: 'containerPath',
      hostPath: 'hostPath',

      // the properties below are optional
      consistency: cdk.DockerVolumeConsistency.CONSISTENT,
    }],
    volumesFrom: ['volumesFrom'],
    workingDirectory: 'workingDirectory',
  },
  deployTime: false,
  displayName: 'displayName',
  exclude: ['exclude'],
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  readers: [grantable],
  sourceKMSKey: keyRef,
});
```

## Initializer

```ts
new AssetImportSource(path: string, options?: AssetOptions)
```

## Properties

- `path`: string (required) — the path to the local file.

## Methods

- `fromAsset(path: string, options?: AssetOptions): ImportSource` (static) — An import source that exists as a local file.

  **Parameters**

  - `path` — the path to the local file.
  - `options` — the configuration for the temporarily created S3 file.

- `fromBucket(bucket: IBucket, key: string): ImportSource` (static) — An import source that exists as an object in an S3 bucket.

  **Parameters**

  - `bucket` — the S3 bucket that contains the data.
  - `key` — the key within the S3 bucket that contains the data.

- `fromInline(data: string): ImportSource` (static) — An import source that uses an inline string.

  **Parameters**

  - `data` — the contents of the KeyValueStore.
