简体   繁体   English

AWS cloudformation 域名和 API 映射

[英]AWS cloudformation domain names and API mappings

I have a domain name example.com and a lambda backend with api gateway set up with cloud formation and code pipeline with the following yaml template: I have a domain name example.com and a lambda backend with api gateway set up with cloud formation and code pipeline with the following yaml template:

 PostSomeApi:
      Type: AWS::Serverless::Function
      Properties:
       Handler: lambda_function.lambda_handler
       Runtime: python3.8
       FunctionName: some-api-name
       CodeUri: ./src/some-api-name 
       Role: !Ref LambdaRoleArn
       Timeout: 45
       Environment:
        Variables:
          accountId: !Ref "AWS::AccountId"
          region:    !Ref "AWS::Region"
       Events:
        SampleApi:
         Type: Api
         Properties:
          Path: /someapiname
          Method: POST

I connected the subdomain api.example.com to lambda api gateway with manual configuration on the console but now I want to include this API mapping in the cloud formation yaml template. I connected the subdomain api.example.com to lambda api gateway with manual configuration on the console but now I want to include this API mapping in the cloud formation yaml template.

How can I do this?我怎样才能做到这一点? This is the manual configuration of the api mapping这是api映射的手动配置

Instead of doing this manually, you have to create AWS::Serverless::Api , where you can provide DomainConfiguration .您必须创建AWS::Serverless::Api ,而不是手动执行此操作,您可以在其中提供DomainConfiguration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM