Amplify Toolbox
    Preparing search index...

    Type Alias HostingProps

    HostingProps: Omit<BlocksHostingProps, "environment"> & {
        configStore?: KindStoreOptions;
        environment?: Record<string, EnvValue | ByoValue>;
        secretStore?: KindStoreOptions;
    }

    Configuration for defineHosting().

    Amplify widens the upstream @aws-blocks/hosting HostingProps in two ways so self-managed hosting can reference externalized values:

    • environment accepts secret('KEY') / config('KEY') markers (and BYO ISecret / IParameter handles) in addition to plain strings. A marker injects only the store locator into the compute Lambdas (never the value) and grants least-privilege read + decrypt; the value is read at runtime with getSecret('KEY') / getConfig('KEY').
    • secretStore / configStore override the per-kind SSM/Secrets Manager namespace. When omitted, defineHosting defaults them to a per-project path (/amplify/hosting/<project>/secrets and /amplify/hosting/<project>/config) so the CLI write, the IAM grant, and the runtime read all agree.

    Type Declaration

    • OptionalconfigStore?: KindStoreOptions

      Namespace/cache options for config() values (SSM Parameter Store). Defaults to { prefix: '/amplify/hosting/<project>/config' }.

    • Optionalenvironment?: Record<string, EnvValue | ByoValue>

      Environment variables injected into all compute (SSR) Lambda functions.

      Accepts:

      • a plain string — appears in plaintext in the template; use only for non-sensitive literals (feature flags, region, service names);
      • secret('KEY') — a sensitive value in AWS Secrets Manager, read at runtime with getSecret('KEY');
      • config('KEY') — a non-sensitive value in SSM Parameter Store, read at runtime with getConfig('KEY');
      • byoSecret('name-or-arn') / byoConfig('name') — a bring-your-own reference to an EXISTING Secrets Manager secret / SSM parameter (resolved to a CDK handle internally, no user CDK required);
      • a BYO ISecret / IParameter CDK handle to an existing store entry.

      For the marker forms only the store locator is injected; the value never enters the CloudFormation template.

      import { defineHosting, secret, config } from '@aws-amplify/hosting';
      defineHosting({
      environment: {
      APP_REGION: 'us-east-1', // non-sensitive literal
      STRIPE_KEY: secret('STRIPE_KEY'), // → getSecret('STRIPE_KEY')
      FEATURE_FLAGS: config('FEATURE_FLAGS'), // → getConfig('FEATURE_FLAGS')
      },
      });
    • OptionalsecretStore?: KindStoreOptions

      Namespace/cache options for secret() values (AWS Secrets Manager). Defaults to { prefix: '/amplify/hosting/<project>/secrets' }.