AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: SSR-micro-frontends Globals: Function: Runtime: nodejs16.x MemorySize: 256 Timeout: 15 Tracing: Active Architectures: - arm64 Parameters: DDBCachedTable: Type: String Default: CachedProductsTable DDBProductsTable: Type: String Default: ProductsTable Resources: DynamoTable: Type: AWS::DynamoDB::Table Properties: TableName: !Ref DDBCachedTable AttributeDefinitions: - AttributeName: ID AttributeType: S KeySchema: - AttributeName: ID KeyType: HASH BillingMode: PAY_PER_REQUEST ProductsTable: Type: AWS::DynamoDB::Table Properties: TableName: !Ref DDBProductsTable AttributeDefinitions: - AttributeName: ID AttributeType: S KeySchema: - AttributeName: ID KeyType: HASH BillingMode: PAY_PER_REQUEST ProductStateMachine: Type: AWS::Serverless::StateMachine Properties: Type: EXPRESS Tracing: Enabled: true DefinitionUri: statemachine/product-orchestrator.asl.json DefinitionSubstitutions: ProductFunctionArn: !GetAtt ProductFunction.Arn TableName: !Ref DynamoTable ProductsTable: !Ref ProductsTable Policies: - LambdaInvokePolicy: FunctionName: !Ref ProductFunction - DynamoDBCrudPolicy: TableName: !Ref DynamoTable - DynamoDBReadPolicy: TableName: !Ref ProductsTable ProductFunction: Type: AWS::Serverless::Function Properties: AutoPublishAlias: prod CodeUri: functions/product Handler: server-build/app.lambdaHandler ServiceDiscoveryID: Type: AWS::SSM::Parameter Properties: Name: /ssr-mfe/catalogARN Type: String Value: !Ref ProductStateMachine HydrateDDBFunction: Type: AWS::Serverless::Function Properties: Environment: Variables: Region: !Ref AWS::Region DatabaseTable: !Ref ProductsTable AutoPublishAlias: prod CodeUri: functions/product Handler: hydrateDDB.lambdaHandler Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductsTable DeploymentCustomResource: Type: Custom::AppConfiguration Properties: ServiceToken: !GetAtt HydrateDDBFunction.Arn