Api Gateway Deployment not updated when AutoPublishAlias is changed

0

Hello, when I update my lambda and I have AutoPublishAlias activated. Api Gateway does not deploy to update the version of the target lambda. what am I doing wrong? my code: https://github.com/fjanuszewski/demo_aws_apigateway_lambda_dynamo

(i'm using swagger)

Globals:
  Function:
    Runtime: nodejs14.x
    AutoPublishAlias: live

Resources:
  CommonsLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      LayerName:
        Fn::Sub: ${AWS::StackName}-CommonsLayer
      Description: "Commons Libs"
      ContentUri: ./layers/commons
      LicenseInfo: Available under the MIT-0 license.
      CompatibleRuntimes:
        - nodejs14.x
    Metadata:
      BuildMethod: nodejs14.x

  ServerlessRestApi:
    Type: AWS::Serverless::Api
    Properties:
      Name: 
        Fn::Sub: ${AWS::StackName}-ApiGateway
      StageName: 
        Ref: Environment
      Variables:
        Environment: 
          Ref: Environment
      DefinitionBody:
        Fn::Transform:
          Name: AWS::Include
          Parameters:
            Location: ./swagger.yaml
            
  GetItem:
    Type: AWS::Serverless::Function
    Properties:
      Handler: app.handler
      Timeout: 30
      MemorySize: 128
      CodeUri: ./functions/getItem
      FunctionName: 
        Fn::Sub: ${AWS::StackName}-GetItem      
      Layers:
        - Ref: CommonsLayer
      Environment:
        Variables:
          ENV: 
            Ref: Environment
          EXAMPLE_TABLE: 
            Ref: ExampleTable
      Policies:
        - AWSLambdaExecute
        - AWSXRayDaemonWriteAccess
        - Statement:
            - Effect: Allow
              Action:
                - "dynamodb:GetItem"
              Resource:
                Fn::GetAtt: ExampleTable.Arn
      Events:
        HttpEvent:
          Type: HttpApi 
          Properties:
            Path: /items/{idItem}
            Method: GET
            ApiId:
              Ref: ServerlessRestApi
gefragt vor 2 Jahren451 Aufrufe
1 Antwort
0

What do you expect to happen? API Gateway should be pointing to the live alias. Every time you publish a new function version, the alias is moved to the new version so there is no need to change anything in API Gateway.

profile pictureAWS
EXPERTE
Uri
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen