Fn::ImportValue

Importing Exported Values with Fn::ImportValue

Fn::ImportValue takes an export name and returns its value. The name may be built with Fn::Sub, but YAML cannot stack short tags (Readable Nesting), so write Fn::ImportValue: in full with !Sub inside. BookNest's API settings stack publishes the catalog table's name in Parameter Store, where the Lambda 24 functions of Database and Compute will read it:

infra/settings.yaml: importing the table name for one stageYAML
Parameters:
  Stage: {Type: String, AllowedValues: [dev, prod], Default: dev}
Resources:
  TableNameParam:
    Type: AWS::SSM::Parameter
    Properties:
      Name: !Sub /booknest/${Stage}/table-name
      Type: String
      Value:
        Fn::ImportValue: !Sub booknest-${Stage}-table-name
Deploying the importing stack and asking who imports the exportShell
aws cloudformation deploy --stack-name booknest-settings-dev --template-file settings.yaml
aws ssm get-parameter --name /booknest/dev/table-name --query Parameter.Value --output text
aws cloudformation list-imports --export-name booknest-dev-table-name
Output
Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - booknest-settings-dev
booknest-dev-books
{
    "Imports": []
}

The value arrived, but list-imports, which on AWS 24 names booknest-settings-dev, is empty: LocalStack 4.13.1 63,725 tracks no imports. Imports work within one account and region; across them, AWS's newer Fn::GetStackOutput reads another stack's output without an export, as a weak reference that does not lock the producer (LocalStack leaves it unresolved, so not run here).