Skip to content

Configuration

Referenceable parameters

The $ResourceParam directive retrieves deployment-time outputs (URLs, ARNs, hostnames, ports, and connection strings) from supported resource types listed on this page. Use it in environment variables, stack outputs, or any string-valued config property to wire resources together when connectTo doesn't cover your specific use case.

Syntax

$ResourceParam takes two arguments: the resource name (matching the key in your config's resources map) and the parameter name.

TypeScript
export default defineConfig(() => {  const api = new LambdaFunction({    packaging: new JsBundleLambdaPackaging({      entryfilePath: './src/handler.ts'    }),    environment: {      GATEWAY_URL: "$ResourceParam('gateway', 'url')"    }  });  const gateway = new HttpApiGateway({});  return {    resources: { api, gateway }  };});

The $ResourceParam directive resolves at deploy time. The resulting value is a string: suitable for environment variables, script inputs, stack outputs, or anywhere a string value is accepted in your Stacktape configuration.

Note:

Some parameters are only available when a resource is configured a certain way. Each resource's parameter table below notes the conditions under which a given parameter is exposed.

The sections below list the available parameters for each resource type. Not all resource types expose referenceable parameters: those that do are grouped by category.

Compute resources

Stacktape compute resources expose $ResourceParam values such as ARNs, URLs, domains, and log group identifiers. Use these to wire compute outputs into other parts of your configuration.

Lambda function

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the function

logGroupArn

Arn of the log group aggregating logs from the function

Web service

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

domain

Web service default domain name

url

Web service default URL

customDomains

Comma-separated list of custom domain names assigned to the Web Service (only available if you use custom domain names)

customDomainUrls

Comma-separated list of custom domain name URLs (only available if you use custom domain names)

cdnDomain

Default domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnUrl

Default url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnCustomDomains

Comma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).

cdnCustomDomainUrls

Comma-separated list of custom domain name URLs of the CDN (only available if you configure custom domain names for the CDN).

Private service

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

address

service host:port pair accessible only to other resources of stack(web-services, multi-container-workloads)

Batch job

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

jobDefinitionArn

Arn of the job definition resource

stateMachineArn

Arn of the state machine controlling the execution flow of the batch job

logGroupArn

Arn of the log group aggregating logs from the batch job

Worker service

Worker services do not currently expose referenceable parameters. Use connectTo for workload-to-resource wiring.

Edge function

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

Multi-container workload

Multi-container workloads do not currently expose referenceable parameters. Use connectTo for workload-to-resource wiring.

Frontend resources

The following frontend resources expose referenceable parameters. Static hosting buckets additionally expose bucket identifiers and (when a CDN is attached) CDN-related parameters. See each resource's parameter table for the exact set of available values.

A website's url is always one URL: the first of its customDomains, or its default Stacktape URL when it has none. customDomainUrls lists every custom domain URL, comma-separated, in the order they are configured. It exists only when the website has custom domains.

Next.js

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

Astro

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

Nuxt

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

SvelteKit

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

SolidStart

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

TanStack Start

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

Remix

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Website URL

Hosting bucket (static sites)

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

name

AWS (physical) name of the bucket

arn

Arn of the bucket

cdnDomain

Default domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnUrl

Default url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnCustomDomains

Comma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).

cdnCustomDomainUrls

Comma-separated list of custom domain name URLs of the CDN (only available if you configure custom domain names for the CDN).

Databases

Stacktape database resources expose connection strings, hostnames, ports, and identifiers via $ResourceParam. These are especially useful when connectTo doesn't cover your wiring need: for example, passing a reader connection string to a specific environment variable.

Relational database

Relational databases expose the richest set of parameters. Standard RDS engines provide host, port, and connection strings. Aurora engines additionally expose reader endpoints for read scaling. Read replica parameters are available when replicas are explicitly configured.

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

connectionString

Fully-formed connection string that can be used to access the primary instance. For aurora databases, this is connectionString to cluster endpoint, which can be used for both reads and writes. Includes host, port, username, password and dbName.

jdbcConnectionString

Fully-formed connection string in JDBC form that can be used to access the primary instance. Includes host, port, username, password and dbName.

host

Hostname (address) of the primary instance that can be used for both reads and writes. For aurora databases, this is hostname of a cluster endpoint, which can be used for both reads and writes.

port

Port of the database.

dbName

Name of the automatically created database (can be configured using the dbName property).

readerHost

Hostname (address) used for reads only. (only available for aurora-postgresql and aurora-mysql engines). If you have multiple instances, it is advised to use readerHost for reads to offload the primary (read/write) host. ReaderHost automatically balances requests between available instances. Connections are auto-balanced among available reader hosts.

readerConnectionString

Same as connectionString but targets readerHosts (only available for aurora-postgresql and aurora-mysql engines). Connections are auto-balanced among available reader hosts.

readerJdbcConnectionString

Same as readerConnectionString but in JDBC format (only available for aurora-postgresql and aurora-mysql engines).

readReplicaHosts

Comma-separated list of read replica hostnames (only available if read replicas are configured). Read replicas can only be used for read operations.

readReplicaConnectionStrings

Comma-separated list of connection strings (URLs) used to connect to read replicas (only available when read replicas are configured). Read replicas can only be used for read operations.

readReplicaJdbcConnectionStrings

Same as readReplicaConnectionStrings but in JDBC format (only available when read replicas are configured).

Aurora DSQL

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

endpoint

TLS endpoint of the DSQL cluster.

port

PostgreSQL port (5432).

databaseName

Default database name (postgres).

username

Built-in database role used by connectTo (admin).

region

AWS region containing the cluster.

id

DSQL cluster ID.

arn

DSQL cluster ARN.

DynamoDB table

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

name

AWS (physical) name of the table

arn

Arn of the table

streamArn

Arn of DynamoDb stream (available only if streamType is configured)

Redis

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

host

In case of NON-sharded cluster(default), this is a hostname of the primary instance that can be used for both reads and writes. In case of sharded cluster, this is cluster's configuration endpoint that can be used for all operations.

readerHost

Hostname (address) that can be used for reads only. (only available for NON-sharded clusters). If you use multiple replicas, it is advised to use readerHost for read operations to offload the primary host. ReaderHost automatically balances requests between available read replicas.

port

Port of the cluster.

sharding

Indicates whether cluster is sharded. Available values: enabled or disabled.

MongoDB Atlas cluster

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

connectionString

Connection string (URL) that allows connecting to the cluster.

Upstash Redis

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

host

Hostname (address) of the Upstash Redis database.

port

Port of the Upstash Redis database.

password

Autogenerated password that can be used to authenticate towards the database.

restToken

Rest token which can be used when reading/writing from/to the database using the REST API

readOnlyRestToken

Rest token which can be used only for reading from the database using the REST API

restUrl

Rest URL which can be used when communicating with the database using the REST API

redisUrl

Standard redis url (including password) which can be used for connecting using cli.

OpenSearch domain

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

domainEndpoint

Endpoint used for communicating with your opensearch-domain

arn

Arn of the domain

Storage

Stacktape storage resources expose bucket names, ARNs, and (when a CDN is attached) CDN-related domain and URL parameters via $ResourceParam.

Bucket

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

name

AWS (physical) name of the bucket

arn

Arn of the bucket

cdnDomain

Default domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnUrl

Default url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnCustomDomains

Comma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).

cdnCustomDomainUrls

Comma-separated list of custom domain name URLs of the CDN (only available if you configure custom domain names for the CDN).

Networking

HTTP API Gateways and Application Load Balancers expose default domains, custom domain lists, and CDN-related parameters via $ResourceParam. Network Load Balancers expose domain and custom domain parameters but do not support CDN attachment.

HTTP API Gateway

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

domain

Default domain name

url

Default URL

customDomains

Comma-separated list of custom domain names assigned to the HTTP Api Gateway (only available if you use custom domain names)

customDomainUrls

Comma-separated list of custom domain name URLs (only available if you use custom domain names)

customDomainUrl

URL of the first custom domain name connected to this resource (only available if you use custom domain names)

cdnDomain

Default domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnUrl

Default url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnCustomDomains

Comma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).

cdnCustomDomainUrls

Comma-separated list of custom domain name URLs of the CDN (only available if you configure custom domain names for the CDN).

Application Load Balancer

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

domain

default domain name of load balancer

customDomains

Comma-separated list of custom domain names assigned to the Load balancer (only available if you use custom domain names)

cdnDomain

Default domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnUrl

Default url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).

cdnCustomDomains

Comma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).

cdnCustomDomainUrls

Comma-separated list of custom domain name URLs of the CDN (only available if you configure custom domain names for the CDN).

Network Load Balancer

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

domain

default domain name of load balancer

customDomains

Comma-separated list of custom domain names assigned to the Load balancer (only available if you use custom domain names)

WebSocket API Gateway

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

apiId

API Gateway ID

url

WebSocket client URL

managementEndpoint

HTTPS endpoint for sending messages to connected clients

canonicalDomain

AWS DNS target

customDomains

Comma-separated list of custom domain names

customDomainUrls

Comma-separated list of custom domain URLs

customDomainUrl

URL of the first custom domain

AppSync API

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

apiId

AppSync API ID

arn

AppSync API ARN

url

GraphQL endpoint URL

realtimeUrl

GraphQL subscriptions endpoint URL

customDomainUrl

Custom GraphQL endpoint URL

apiKey

Sensitive API key value (only for API key authentication)

Messaging and orchestration

Messaging and orchestration resources expose ARNs, names and URLs, such as a queue URL or the brokers of a Kafka cluster.

SQS queue

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

SNS topic

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

Event bus

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the event bus

archiveArn

Arn of the event bus archive (available only if the archivation is enabled)

State machine

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the state machine.

name

AWS (physical) name of the state machine.

Kinesis stream

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the Kinesis stream.

name

AWS (physical) name of the Kinesis stream.

Kafka cluster

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Amazon MSK cluster ARN

name

Physical MSK cluster name

bootstrapServers

Comma-separated IAM bootstrap broker addresses

Email sender

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

identity

Canonical SES sender identity

identityArn

SES identity ARN

region

AWS region containing the identity

configurationSetName

SES configuration set used by default

feedbackTopicArn

Shared SNS topic ARN for bounce and complaint events

Security

Stacktape security resources expose identifiers and ARNs via $ResourceParam: user pool IDs, client IDs, and firewall ARNs.

User auth pool

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

id

Id of the userpool

clientId

Id of the userpool

domain

Domain of the userpool

Web application firewall

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the web-app-firewall.

scope

Scope of the web-app-firewall (regional or cdn).

Platform resources

EFS filesystem

connectTo injects these values but does not mount the filesystem; configure a volume mount when the workload needs its files.

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

arn

Arn of the EFS filesystem.

Convex

Convex exposes backend URLs, dashboard URL, and sensitive credentials via $ResourceParam. The adminKey and instanceSecret parameters are sensitive and are never auto-injected by connectTo: reference them explicitly with $ResourceParam when needed.

Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.

url

Cloud origin (CONVEX_CLOUD_ORIGIN) used by frontend clients.

siteUrl

HTTP-actions origin (CONVEX_SITE_ORIGIN) where httpAction() routes live.

dashboardUrl

Admin dashboard URL. Only available when the dashboard is enabled.

adminKey

Sensitive root credentials for the deployment, resolved from AWS Secrets Manager. Reference explicitly with $ResourceParam; never auto-injected by connectTo.

instanceSecret

Sensitive boot secret stored in AWS Secrets Manager. Almost never needed by user code.

AgentCore Runtime

AgentCore Memory

AgentCore Gateway

AgentCore Browser

AgentCore Code Interpreter

Using parameters in practice

The $ResourceParam directive is most commonly used in environment variables and stack outputs. The examples below show the primary patterns for wiring resource outputs into your configuration.

Environment variables

The most common use of $ResourceParam is injecting resource details into workloads via environment variables. Use it when you want to choose your own environment variable name, reference a specific documented parameter directly, or pass a value into a context that connectTo does not support.

In this example, the Lambda function uses connectTo for IAM permissions to access the bucket, and $ResourceParam to read the bucket's ARN into a custom environment variable.

TypeScript
export default defineConfig(() => {  const uploads = new Bucket({});  const processor = new LambdaFunction({    packaging: new JsBundleLambdaPackaging({      entryfilePath: './src/process.ts'    }),    environment: {      UPLOAD_BUCKET_ARN: "$ResourceParam('uploads', 'arn')"    },    connectTo: [uploads]  });  return {    resources: { uploads, processor }  };});

Stack outputs

Use $ResourceParam in stack outputs to surface deployment values in the terminal and stack info file. Outputs are useful for sharing endpoints with other teams, CI pipelines, or other stacks.

TypeScript
export default defineConfig(() => {  const gateway = new HttpApiGateway({});  return {    resources: { gateway },    stackConfig: {      outputs: [        {          name: 'apiUrl',          value: "$ResourceParam('gateway', 'url')"        }      ]    }  };});

Stack outputs can be exported for cross-stack use by setting export: true. Exported outputs can be referenced from other stacks using the $CfStackOutput() directive.

Difference from connectTo

connectTo is a higher-level abstraction for wiring resources together. For supported resource types (databases, buckets, queues, Lambda functions, and others documented on the connecting resources page), connectTo grants IAM permissions, opens security group rules for network-accessible resources like databases and Redis, and injects a predefined set of environment variables automatically.

$ResourceParam gives you access to individual parameters without side effects: no permissions are granted and no security groups are modified. Use $ResourceParam when you want to:

  • Choose your own environment variable name for a resource parameter
  • Use a resource parameter outside an environment variable (e.g. in stack outputs or other resource properties)
  • Reference one of the documented parameters directly from a resource type

Use connectTo when you want Stacktape's documented IAM, networking, and environment-variable wiring. For most workload-to-resource wiring, start with connectTo and add $ResourceParam for any additional parameters you need.

Referenceable parameters FAQ

How is $ResourceParam different from connectTo?

connectTo is a higher-level abstraction that, for supported resource types, grants IAM permissions, opens security group rules, and injects a predefined set of environment variables. $ResourceParam gives you access to individual parameters without any side effects: no permissions are granted and no security groups are modified. Use connectTo for standard access patterns; use $ResourceParam for specific values, non-standard wiring, or resource types not covered by connectTo.

Can I reference resources from other stacks?

$ResourceParam references resources defined in the same Stacktape configuration. To share a value with another stack, add it to stackConfig.outputs with export: true and read it there with $CfStackOutput(). Stages and environments shows a full example.

What happens if I reference a parameter that doesn't exist?

If you reference a resource name not defined in your config, or a parameter name not supported by that resource type, the configuration is invalid. Check the parameter tables on this page to confirm the parameter name is supported for the resource type you are referencing.

Are CDN parameters always available?

CDN-related parameters (cdnDomain, cdnUrl, cdnCustomDomains, cdnCustomDomainUrls) are only available on resources that have a cdn configuration block attached. Several resource types expose CDN parameters when configured: including buckets, hosting buckets, web services, Application Load Balancers, and HTTP API Gateways. Check the per-resource parameter table above for the exact CDN parameter names exposed by each type.

How do relational database parameters differ between engine types?

Standard RDS engines (Postgres, MySQL, MariaDB) expose core parameters: host, port, connection string, JDBC connection string, and database name. Aurora engines (Aurora PostgreSQL, Aurora MySQL) additionally expose reader endpoints (reader host and reader connection strings) for distributing read traffic. Read replica parameters are a separate set, available only when read replicas are explicitly configured. See the relational database resource page and the parameter table above for the full list.

Can I use $ResourceParam in hooks and scripts?

Yes. Scripts and lifecycle hooks can use $ResourceParam to reference resource outputs: the environment and parameters properties of a script accept directives like $ResourceParam(), which resolve at deploy time. A common pattern is passing a database connection string into a seeding script. A service's releaseCommand gets the service's own environment variables.