AWS SAM - How can create an API event for a FunctionAlias?

My SAM template is currently using a Lambda function to provide information through an API Gateway. However, I would like to have the API Gateway pointing to an alias instead.

How can I do it with SAM?

LambdaFunction:
    Type: 'AWS::Serverless::Function'
    Properties: 
      Runtime: nodejs14.x
      Handler: index.handler
      CodeUri: ./software
      MemorySize: 128
      FunctionName: Name
      Timeout: 5
      Policies:
      - AmazonDynamoDBReadOnlyAccess
      Events:
        MyApiResource:
          Type: Api
          Properties:
            Path: /path
            Method: get
            RestApiId: !Ref ApiGatewayApi
  FunctionAlias:
    Type: AWS::Lambda::Alias
    Properties:
      FunctionName: !Ref LambdaFunction
      FunctionVersion: !GetAtt FunctionVersion.Version
      Name: prod
  

I tried to cut and past the events to the alias but it didnt work.


Solution 1:

AutoPublishAlias: prod

Link here