Help us understand the problem. What is going on with this article?

API Gateway → Lambda 同期・非同期 、API Gateway → SQS 、API Gateway → ALB with CloudFormation

AWS CloudFormationを用いて、API GatewayからLambdaを同期・非同期で呼び出します。

CloudFormationテンプレートと、Lambdaソースは以下のような構成にしました。構成を変える場合、LambdaのCodeUriでディレクトリを、Handlerでファイル名を変更できます。

 |
 |--apigateway.yml
 |--Makefile #なくても構わないです。コマンドを毎回打つのが面倒なので作っただけです。
 |--Lambda
      |--test
           test.py
Makefile
.PHONY: deploy
deploy:
    $(call blue , "Lambda package & deploy")
    @aws cloudformation package --template-file apigateway.yml --s3-bucket ご自身のS3バケット名 --output-template-file packaged-template.yml
    @aws cloudformation deploy --template-file packaged-template.yml --stack-name APIGateway

define blue
    @tput setaf 6 && echo $1 && tput sgr0
endef

API Gateway → Lambda 同期実行版

API GatewayとLambdaを作成します。
以下、Parameters内のlambda-roleというところを、ご自身のIAM Role名に変更してください。

apigateway.yml
AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Description: API Gateway Sample
Parameters:
  #Lambda
  LambdaRole:
    Type: String
    Default: lambda-role

Resources:
  #-------------------------------------------------------
  #   API Gateway
  #-------------------------------------------------------
  #RestApi
  APIGatewayRestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: api_gateway

  #Resource
  APIGatewayResource:
    Type: AWS::ApiGateway::Resource
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      ParentId: !GetAtt APIGatewayRestApi.RootResourceId
      PathPart: target_lambda

  #Method
  APIGatewayMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        # IntegrationResponses:
        #   - StatusCode: 202
        # PassthroughBehavior: WHEN_NO_TEMPLATES
        # RequestParameters:
        #   "integration.request.header.X-Amz-Invocation-Type": "'Event'"
        # RequestTemplates:
        #   "application/json": !Join
        #     - ""
        #     - - "#set($allParams = $input.params())\n{\n\"body-json\" : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n #set($params = $allParams.get($type))\n\"$type\" : {\n #foreach($paramName in $params.keySet())\n \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\n #if($foreach.hasNext),#end\n #end\n}\n "
        #       - "#if($foreach.hasNext),#end\n#end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n #if($foreach.hasNext),#end\n#end\n},\n"
        #       - "\"context\" : {\n \"account-id\" : \"$context.identity.accountId\",\n \"api-id\" : \"$context.apiId\",\n \"api-key\" : \"$context.identity.apiKey\",\n \"authorizer-principal-id\" : \"$context.authorizer.principalId\",\n \"caller\" : \"$context.identity.caller\",\n \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\",\n \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\",\n \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\",\n "
        #       - "\"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\",\n \"http-method\" : \"$context.httpMethod\",\n \"stage\" : \"$context.stage\",\n "
        #       - "\"source-ip\" : \"$context.identity.sourceIp\",\n \"user\" : \"$context.identity.user\",\n \"user-agent\" : \"$context.identity.userAgent\",\n \"user-arn\" : \"$context.identity.userArn\",\n \"request-id\" : \"$context.requestId\",\n \"resource-id\" : \"$context.resourceId\",\n \"resource-path\" : \"$context.resourcePath\"\n }\n}"
        Uri: !Join
          - ""
          - - !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path"
            - !Sub "/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:"
            - !Sub "${AWS::AccountId}:function:${TestLambdaFunction}/invocations"
      MethodResponses:
        # - StatusCode: 202 #default response status code with async invocation
        - StatusCode: 200
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Deployment
  APIGatewayDeployment:
    Type: AWS::ApiGateway::Deployment
    DependsOn: 
      - APIGatewayMethod
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      StageName: test

  #API Gateway needs to be given the right to invoke AWS Lambda
  APIGatewayLambdaInvokeRole:
    Type: AWS::Lambda::Permission
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !Ref TestLambdaFunction
      Principal: apigateway.amazonaws.com

  #-------------------------------------------------------
  #   Lambda
  #-------------------------------------------------------
  #API Gateway Target Lambda Function
  TestLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: Lambda/test
      FunctionName: target_lambda
      Handler: target_lambda.lambda_handler
      MemorySize: 128
      Role: !Sub arn:aws:iam::${AWS::AccountId}:role/${LambdaRole}
      Runtime: python3.8
      Timeout: 900
      Environment:
        Variables:
          Key: Value

API Gateway → Lambda 非同期実行版

非同期の場合、DLQという便利な機能が使えるので、それも付け足しておきます。

以下、Parameters内のlambda-roleというところを、ご自身のIAM Role名に変更してください。

apigateway.yml
AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Description: API Gateway Sample
Parameters:
  #Lambda
  LambdaRole:
    Type: String
    Default: lambda-role

Resources:
  #-------------------------------------------------------
  #   API Gateway
  #-------------------------------------------------------
  #RestApi
  APIGatewayRestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: api_gateway

  #Resource
  APIGatewayResource:
    Type: AWS::ApiGateway::Resource
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      ParentId: !GetAtt APIGatewayRestApi.RootResourceId
      PathPart: target_lambda

  #Method
  APIGatewayMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      Integration:
        Type: AWS
        IntegrationHttpMethod: POST
        IntegrationResponses:
          - StatusCode: 202
        PassthroughBehavior: WHEN_NO_TEMPLATES
        RequestParameters:
          "integration.request.header.X-Amz-Invocation-Type": "'Event'"
        RequestTemplates:
          "application/json": !Join
            - ""
            - - "#set($allParams = $input.params())\n{\n\"body-json\" : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n #set($params = $allParams.get($type))\n\"$type\" : {\n #foreach($paramName in $params.keySet())\n \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\n #if($foreach.hasNext),#end\n #end\n}\n "
              - "#if($foreach.hasNext),#end\n#end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n #if($foreach.hasNext),#end\n#end\n},\n"
              - "\"context\" : {\n \"account-id\" : \"$context.identity.accountId\",\n \"api-id\" : \"$context.apiId\",\n \"api-key\" : \"$context.identity.apiKey\",\n \"authorizer-principal-id\" : \"$context.authorizer.principalId\",\n \"caller\" : \"$context.identity.caller\",\n \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\",\n \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\",\n \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\",\n "
              - "\"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\",\n \"http-method\" : \"$context.httpMethod\",\n \"stage\" : \"$context.stage\",\n "
              - "\"source-ip\" : \"$context.identity.sourceIp\",\n \"user\" : \"$context.identity.user\",\n \"user-agent\" : \"$context.identity.userAgent\",\n \"user-arn\" : \"$context.identity.userArn\",\n \"request-id\" : \"$context.requestId\",\n \"resource-id\" : \"$context.resourceId\",\n \"resource-path\" : \"$context.resourcePath\"\n }\n}"
        Uri: !Join
          - ""
          - - !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path"
            - !Sub "/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:"
            - !Sub "${AWS::AccountId}:function:${TestLambdaFunction}/invocations"
      MethodResponses:
        - StatusCode: 202 #default response status code with async invocation
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Deployment
  APIGatewayDeployment:
    Type: AWS::ApiGateway::Deployment
    DependsOn: 
      - APIGatewayMethod
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      StageName: test

  #API Gateway needs to be given the right to invoke AWS Lambda
  APIGatewayLambdaInvokeRole:
    Type: AWS::Lambda::Permission
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !Ref TestLambdaFunction
      Principal: apigateway.amazonaws.com

  #-------------------------------------------------------
  #   Lambda
  #-------------------------------------------------------
  #API Gateway Target Lambda Function
  TestLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: Lambda/test
      DeadLetterQueue:
        TargetArn: !GetAtt SQS.Arn
        Type: SQS
      FunctionName: target_lambda
      Handler: target_lambda.lambda_handler
      MemorySize: 128
      Role: !Sub arn:aws:iam::${AWS::AccountId}:role/${LambdaRole}
      Runtime: python3.8
      Timeout: 900
      Environment:
        Variables:
          Key: Value

  #-------------------------------------------------------
  # SQS
  #-------------------------------------------------------
  SQS:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: test
      DelaySeconds: 0
      MaximumMessageSize: 262144
      MessageRetentionPeriod: 345600
      ReceiveMessageWaitTimeSeconds: 20
      VisibilityTimeout: 30

API Gateway → SQS Get method, Post method

CloudFormationを用いて API GatewayからSQSを実行するアーキテクチャを構築します。API Gateway呼び出しメソッドはGetとPostを作成しました。lambda-roleをご自身のLambda実行用IAM Role名、APIGatewayRoleをご自身のSQS実行用IAM Role名に変更してください。

AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Description: API Gateway Sample
Parameters:
  #API Gateway
  ApigatewayRole:
    Type: String
    Default: APIGatewayRole
  #Lambda
  LambdaRole:
    Type: String
    Default: lambda-role

Resources:
  #-------------------------------------------------------
  #   API Gateway
  #-------------------------------------------------------
  #RestApi
  APIGatewayRestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: api_gateway

  #Resource
  APIGatewayResource:
    Type: AWS::ApiGateway::Resource
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      ParentId: !GetAtt APIGatewayRestApi.RootResourceId
      PathPart: target_sqs

  #Get Method
  APIGatewayGetMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      RequestParameters:
        "method.request.querystring.id" : true
      Integration:
        #API GatewayがSQSを実行するためのIAM Role
        Credentials: !Sub arn:aws:iam::${AWS::AccountId}:role/${ApigatewayRole}
        Type: AWS
        IntegrationHttpMethod: POST
        IntegrationResponses:
          - StatusCode: 200
        PassthroughBehavior: WHEN_NO_MATCH
        RequestParameters:
          "integration.request.querystring.Action": "'SendMessage'"
          "integration.request.querystring.MessageBody": "method.request.querystring.id"
        Uri: !Join
          - ""
          - - !Sub arn:aws:apigateway:${AWS::Region}:sqs:path/${AWS::AccountId}/
            - !GetAtt SQS.QueueName
      MethodResponses:
        - StatusCode: 200
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Post Method
  APIGatewayPostMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: POST
      Integration:
        Credentials: !Sub arn:aws:iam::${AWS::AccountId}:role/${ApigatewayRole}
        Type: AWS
        IntegrationHttpMethod: POST
        IntegrationResponses:
          - StatusCode: 200
        PassthroughBehavior: WHEN_NO_MATCH
        RequestParameters:
          "integration.request.querystring.Action": "'SendMessage'"
        Uri: !Join
          - ""
          - - !Sub arn:aws:apigateway:${AWS::Region}:sqs:path/${AWS::AccountId}/
            - !GetAtt SQS.QueueName
      MethodResponses:
        - StatusCode: 200
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Deployment
  APIGatewayDeployment:
    Type: AWS::ApiGateway::Deployment
    DependsOn:
      - APIGatewayGetMethod
      - APIGatewayPostMethod
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      StageName: test

  #-------------------------------------------------------
  # SQS
  #-------------------------------------------------------
  SQS:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: test
      DelaySeconds: 0
      MaximumMessageSize: 262144
      MessageRetentionPeriod: 345600
      ReceiveMessageWaitTimeSeconds: 20
      VisibilityTimeout: 30

API Gateway → Application Load Balancer (ALB)

APIGatewayRoleを、API GatewayがALBにリクエストをつなげるための、ご自身のIAM Role名に変更してください。

AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Description: API Gateway Sample
Parameters:
  #Project Name Parameter
  ProjectPrefix:
    Type: String
    Default: ""

  #NetWork COnfigration Parameter
  VPCCIDR:
    Type: String
    Default: "192.168.0.0/16"
  PublicSubnetACIDR:
    Type: String
    Default: "192.168.0.0/24"
  PublicSubnetCCIDR:
    Type: String
    Default: "192.168.64.0/24"
  PrivateSubnetACIDR:
    Type: String
    Default: "192.168.128.0/24"
  PrivateSubnetCCIDR:
    Type: String
    Default: "192.168.192.0/24"

  #API Gateway
  ApigatewayRole:
    Type: String
    Default: APIGatewayRole

Resources:
  #-------------------------------------------------------
  #   API Gateway
  #-------------------------------------------------------
  #RestApi
  APIGatewayRestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: api_gateway

  #Resource
  APIGatewayResource:
    Type: AWS::ApiGateway::Resource
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      ParentId: !GetAtt APIGatewayRestApi.RootResourceId
      PathPart: target_alb

  #Get Method
  APIGatewayGetMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      Integration:
        Credentials: !Sub arn:aws:iam::${AWS::AccountId}:role/${ApigatewayRole}
        Type: HTTP
        IntegrationHttpMethod: GET
        IntegrationResponses:
          - StatusCode: 200
        PassthroughBehavior: WHEN_NO_MATCH
        Uri: !Join
          - ""
          - - http://
            - !GetAtt ALB.DNSName
      MethodResponses:
        - StatusCode: 200
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Post Method
  APIGatewayPostMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: POST
      Integration:
        Credentials: !Sub arn:aws:iam::${AWS::AccountId}:role/${ApigatewayRole}
        Type: HTTP
        IntegrationHttpMethod: POST
        IntegrationResponses:
          - StatusCode: 200
        PassthroughBehavior: WHEN_NO_MATCH
        Uri: !Join
          - ""
          - - http://
            - !GetAtt ALB.DNSName
      MethodResponses:
        - StatusCode: 200
      ResourceId: !Ref APIGatewayResource
      RestApiId: !Ref APIGatewayRestApi

  #Deployment
  APIGatewayDeployment:
    Type: AWS::ApiGateway::Deployment
    DependsOn:
      - APIGatewayGetMethod
      - APIGatewayPostMethod
    Properties:
      RestApiId: !Ref APIGatewayRestApi
      StageName: test

  # ------------------------------------------------------------#
  #  VPC
  # ------------------------------------------------------------#
  VPC:
    Type: "AWS::EC2::VPC"
    Properties:
      CidrBlock: !Ref VPCCIDR
      EnableDnsSupport: "true"
      EnableDnsHostnames: "true"
      InstanceTenancy: default
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}vpc"
  InternetGateway:
    Type: "AWS::EC2::InternetGateway"
    Properties:
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}igw"
  InternetGatewayAttachment:
    Type: "AWS::EC2::VPCGatewayAttachment"
    Properties:
      InternetGatewayId: !Ref InternetGateway
      VpcId: !Ref VPC

  # ------------------------------------------------------------#
  #  Subnet
  # ------------------------------------------------------------#
  PublicSubnetA:
    Type: "AWS::EC2::Subnet"
    Properties:
      MapPublicIpOnLaunch: true
      AvailabilityZone: !Sub ${AWS::Region}a
      CidrBlock: !Ref PublicSubnetACIDR
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}public-subnet-a"
  PublicSubnetC:
    Type: "AWS::EC2::Subnet"
    Properties:
      MapPublicIpOnLaunch: true
      AvailabilityZone: !Sub ${AWS::Region}c
      CidrBlock: !Ref PublicSubnetCCIDR
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}public-subnet-c"
  PrivateSubnetA:
    Type: "AWS::EC2::Subnet"
    Properties:
      MapPublicIpOnLaunch: false
      AvailabilityZone: !Sub ${AWS::Region}a
      CidrBlock: !Ref PrivateSubnetACIDR
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}private-subnet-a"
  PrivateSubnetC:
    Type: "AWS::EC2::Subnet"
    Properties:
      MapPublicIpOnLaunch: false
      AvailabilityZone: !Sub ${AWS::Region}c
      CidrBlock: !Ref PrivateSubnetCCIDR
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}private-subnet-c"

  # ------------------------------------------------------------#
  #  RouteTable
  # ------------------------------------------------------------#
  PublicRouteTableA:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}public-route-a"
  PublicRouteTableC:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}public-route-c"
  PrivateRouteTableA:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}private-route-a"
  PrivateRouteTableC:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${ProjectPrefix}private-route-c"

  # ------------------------------------------------------------#
  # Routing
  # ------------------------------------------------------------#
  PublicRouteA:
    Type: "AWS::EC2::Route"
    DependsOn:
      - InternetGatewayAttachment
    Properties:
      RouteTableId: !Ref PublicRouteTableA
      DestinationCidrBlock: "0.0.0.0/0"
      GatewayId: !Ref InternetGateway
  PublicRouteC:
    Type: "AWS::EC2::Route"
    DependsOn:
      - InternetGatewayAttachment
    Properties:
      RouteTableId: !Ref PublicRouteTableC
      DestinationCidrBlock: "0.0.0.0/0"
      GatewayId: !Ref InternetGateway

  # ------------------------------------------------------------#
  # RouteTable Associate
  # ------------------------------------------------------------#
  PublicSubnetARouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnetA
      RouteTableId: !Ref PublicRouteTableA
  PublicSubnetCRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnetC
      RouteTableId: !Ref PublicRouteTableC
  PrivateSubnetARouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PrivateSubnetA
      RouteTableId: !Ref PrivateRouteTableA
  PrivateSubnetCRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PrivateSubnetC
      RouteTableId: !Ref PrivateRouteTableC
  # ------------------------------------------------------------#
  # ALB
  # ------------------------------------------------------------#
  SecurityGroupForALB:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupName: !Sub ${ProjectPrefix}SecurityGroupForALB
      GroupDescription: This is for SecurityGroupForALB
      VpcId: !Ref VPC
      SecurityGroupIngress:
        - CidrIp: "0.0.0.0/0"
          Description: This is for ALB
          FromPort: 80
          IpProtocol: tcp
          ToPort: 80
      Tags:
        - Key: Name
          Value: !Sub ${ProjectPrefix}SecurityGroupForALB
  #Listener
  Listener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
        - TargetGroupArn: !Ref TargetGroup
          Type: forward
      LoadBalancerArn: !Ref ALB
      Port: 80
      Protocol: HTTP
  #ALB
  ALB:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      IpAddressType: ipv4
      Name: !Sub ${ProjectPrefix}LoadBalancer
      Scheme: internet-facing
      SecurityGroups:
        - !Ref SecurityGroupForALB
      Subnets:
        - !Ref PublicSubnetA
        - !Ref PublicSubnetC
      Type: application
  #TargetGroup
  TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      HealthCheckEnabled: true
      HealthCheckIntervalSeconds: 60 #最大300
      HealthCheckPath: /healthcheck
      HealthCheckPort: traffic-port
      HealthCheckProtocol: HTTP
      HealthCheckTimeoutSeconds: 30 #HealthCheckIntervalSeconds よりも小さい値でなくてはならない
      HealthyThresholdCount: 5
      Matcher:
        HttpCode: 301
      Name: !Sub ${ProjectPrefix}TargetGroup
      Port: 80
      Protocol: HTTP
      TargetType: ip
      UnhealthyThresholdCount: 3
      VpcId: !Ref VPC
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした