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.
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.
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.
arnArn of the function
logGroupArnArn 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.
domainWeb service default domain name
urlWeb service default URL
customDomainsComma-separated list of custom domain names assigned to the Web Service (only available if you use custom domain names)
customDomainUrlsComma-separated list of custom domain name URLs (only available if you use custom domain names)
cdnDomainDefault domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnUrlDefault url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnCustomDomainsComma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).
cdnCustomDomainUrlsComma-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.
addressservice
host:portpair 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.
jobDefinitionArnArn of the job definition resource
stateMachineArnArn of the state machine controlling the execution flow of the batch job
logGroupArnArn 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.
urlWebsite URL
Astro
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
Nuxt
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
SvelteKit
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
SolidStart
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
TanStack Start
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
Remix
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
urlWebsite URL
Hosting bucket (static sites)
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
nameAWS (physical) name of the bucket
arnArn of the bucket
cdnDomainDefault domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnUrlDefault url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnCustomDomainsComma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).
cdnCustomDomainUrlsComma-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.
connectionStringFully-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.
jdbcConnectionStringFully-formed connection string in JDBC form that can be used to access the primary instance. Includes host, port, username, password and dbName.
hostHostname (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.
portPort of the database.
dbNameName of the automatically created database (can be configured using the
dbNameproperty).readerHostHostname (address) used for reads only. (only available for
aurora-postgresqlandaurora-mysqlengines). 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.readerConnectionStringSame as connectionString but targets readerHosts (only available for
aurora-postgresqlandaurora-mysqlengines). Connections are auto-balanced among available reader hosts.readerJdbcConnectionStringSame as readerConnectionString but in JDBC format (only available for
aurora-postgresqlandaurora-mysqlengines).readReplicaHostsComma-separated list of read replica hostnames (only available if read replicas are configured). Read replicas can only be used for read operations.
readReplicaConnectionStringsComma-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.
readReplicaJdbcConnectionStringsSame 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.
endpointTLS endpoint of the DSQL cluster.
portPostgreSQL port (5432).
databaseNameDefault database name (postgres).
usernameBuilt-in database role used by connectTo (admin).
regionAWS region containing the cluster.
idDSQL cluster ID.
arnDSQL cluster ARN.
DynamoDB table
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
nameAWS (physical) name of the table
arnArn of the table
streamArnArn of DynamoDb stream (available only if
streamTypeis configured)
Redis
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
hostIn 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.
readerHostHostname (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.
portPort of the cluster.
shardingIndicates whether cluster is sharded. Available values:
enabledordisabled.
MongoDB Atlas cluster
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
connectionStringConnection string (URL) that allows connecting to the cluster.
Upstash Redis
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
hostHostname (address) of the Upstash Redis database.
portPort of the Upstash Redis database.
passwordAutogenerated password that can be used to authenticate towards the database.
restTokenRest token which can be used when reading/writing from/to the database using the REST API
readOnlyRestTokenRest token which can be used only for reading from the database using the REST API
restUrlRest URL which can be used when communicating with the database using the REST API
redisUrlStandard 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.
domainEndpointEndpoint used for communicating with your opensearch-domain
arnArn 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.
nameAWS (physical) name of the bucket
arnArn of the bucket
cdnDomainDefault domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnUrlDefault url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnCustomDomainsComma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).
cdnCustomDomainUrlsComma-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.
domainDefault domain name
urlDefault URL
customDomainsComma-separated list of custom domain names assigned to the HTTP Api Gateway (only available if you use custom domain names)
customDomainUrlsComma-separated list of custom domain name URLs (only available if you use custom domain names)
customDomainUrlURL of the first custom domain name connected to this resource (only available if you use custom domain names)
cdnDomainDefault domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnUrlDefault url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnCustomDomainsComma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).
cdnCustomDomainUrlsComma-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.
domaindefault domain name of load balancer
customDomainsComma-separated list of custom domain names assigned to the Load balancer (only available if you use custom domain names)
cdnDomainDefault domain of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnUrlDefault url of the CDN distribution (only available if you DO NOT configure custom domain names for the CDN).
cdnCustomDomainsComma-separated list of custom domain names assigned to the CDN (only available if you configure custom domain names for the CDN).
cdnCustomDomainUrlsComma-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.
domaindefault domain name of load balancer
customDomainsComma-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.
apiIdAPI Gateway ID
urlWebSocket client URL
managementEndpointHTTPS endpoint for sending messages to connected clients
canonicalDomainAWS DNS target
customDomainsComma-separated list of custom domain names
customDomainUrlsComma-separated list of custom domain URLs
customDomainUrlURL of the first custom domain
AppSync API
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
apiIdAppSync API ID
arnAppSync API ARN
urlGraphQL endpoint URL
realtimeUrlGraphQL subscriptions endpoint URL
customDomainUrlCustom GraphQL endpoint URL
apiKeySensitive 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.
arnArn of the event bus
archiveArnArn 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.
arnArn of the state machine.
nameAWS (physical) name of the state machine.
Kinesis stream
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
arnArn of the Kinesis stream.
nameAWS (physical) name of the Kinesis stream.
Kafka cluster
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
arnAmazon MSK cluster ARN
namePhysical MSK cluster name
bootstrapServersComma-separated IAM bootstrap broker addresses
Email sender
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
identityCanonical SES sender identity
identityArnSES identity ARN
regionAWS region containing the identity
configurationSetNameSES configuration set used by default
feedbackTopicArnShared 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.
idId of the userpool
clientIdId of the userpool
domainDomain of the userpool
Web application firewall
Reference these parameters with the $ResourceParam directive: $ResourceParam('<resource-name>', '<parameter>'). See referenceable parameters.
arnArn of the
web-app-firewall.scopeScope of the
web-app-firewall(regionalorcdn).
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.
arnArn 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.
urlCloud origin (CONVEX_CLOUD_ORIGIN) used by frontend clients.
siteUrlHTTP-actions origin (CONVEX_SITE_ORIGIN) where httpAction() routes live.
dashboardUrlAdmin dashboard URL. Only available when the dashboard is enabled.
adminKeySensitive root credentials for the deployment, resolved from AWS Secrets Manager. Reference explicitly with $ResourceParam; never auto-injected by connectTo.
instanceSecretSensitive 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.
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.
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.