Skip to main content

Create a Location

A Location defines where data is actually stored. Supported location types include DynamoDB, Snowflake, Cognito, Elasticsearch, and more.

Add a Location using one of the Location sub-types. Here you'll use Location.DynamoDB to setup a basic storage location that is backed by DynamoDB tables.

You'll need to pass in a reference to an existing Environment (exampleEnvironment in the example below), and a unique name for the location.

stack.ts
// Update your imports
import { Environment, DynamoDBLocationCapacityMode, Location } from "@stage-tech/depot-cdk";

const ddbLocation = new Location.DynamoDB(this, "DDBLocation", {
environment: exampleEnvironment,
name: "my-ddb-location",
capacityMode: DynamoDBLocationCapacityMode.ONDEMAND
});

Using Locations

Locations are usually passed into a Dataset when creating them (see StageDepotDatasetProps). You can also enable secondary / other storage locations in your environment by adding further Locations to your CDK project, and creating a Composite Location type.

tip

Locations can be looked up across different CDK stacks using the fromLocationName function available on each Location type.

As an example: Location.DynamoDB.fromLocationName()