Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

260
Vistas
AWS CloudFormation API GatewayV2 Route Creation

I am creating a template to create an http api with apigatewayv2.

My API definition in template is:

sfHttpApi:
    Type: AWS::ApiGatewayV2::Api
    DependsOn: sfLambdaFunction
    Properties:
      Name: !Sub sfHttpAPI-${Region}-${Env}
      ProtocolType: HTTP
      Target: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${sfLambdaFunction}/invocations
      CredentialsArn: !GetAtt sfApiGatewayRole.Arn

  sfApiTriggerLambdaPermission:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !GetAtt sfLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub 'arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${sfHttpApi}/' 

  sfApiLambdProxyIntegration:
    Type: "AWS::ApiGatewayV2::Integration"
    Properties:
      Description: Lambda Integration
      ConnectionType: INTERNET
      IntegrationMethod: POST
      IntegrationUri: !Sub  "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${sfLambdaFunction.Arn}/invocations"
      PayloadFormatVersion: '1.0'
      ApiId: !Ref sfHttpApi
      IntegrationType: AWS_PROXY

  sfRoute:
    Type: 'AWS::ApiGatewayV2::Route'
    DependsOn:
      - sfApiLambdProxyIntegration
    Properties:
      ApiId: !Ref sfHttpApi
      RouteKey: 'POST/'  **??? This is the part I dont know how to set**
      AuthorizationType: NONE
      Target: !Join 
        - /
        - - integrations
          - !Ref sfApiLambdProxyIntegration

I tried in different way to set routekey in route definition but getting error while creating the stack:

The provided route key is not formatted properly for HTTP protocol. Format should be " /" or "$default" (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: 53198c85-fc41-4c76-89c4-7d2db7a7a5b6)

How can I set the routekey?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Put a space after POST, i.e. POST /.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda