create cloud watch log group for api gateway

0

Trying to create log group for the aws , but its giving insufficient permission

CFT for log group

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "The template for API gateway stage.",
    "Resources": {
        "logGroup": {
            "Type": "AWS::Logs::LogGroup",
            "Properties": {
                "LogGroupName": "name"
            }
        }
    },
    "Outputs": {
        "arn": {
            "Description": "The API Gateway stage name",
            "Value": {
                "Fn::GetAtt": [
                    "logGroup",
                    "Arn"
                  ]
            }
        }
    }
}

CFT for API stage

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "The template for API gateway stage.",
    "Parameters": {
      "logGroupArn": {
        "Type": "String"
      },
      "apiId": {
        "Type": "String"
      }
    },
    "Resources": {
      "apiStage": {
        "Type": "AWS::ApiGatewayV2::Stage",
        "Properties": {
          "AccessLogSettings": {
            "DestinationArn" : {"Ref" : "logGroupArn"},
            "Format": "{\"requestId\":\"$context.requestId\", \"ip\":\"$context.identity.sourceIp\", \"caller\":\"$context.identity.caller\", \"user\":\"$context.identity.user\",\"requestTime\":\"$context.requestTime\", \"routeKey\":\"$context.routeKey\", \"status\":\"$context.status\"}"
          },
          "ApiId": {"Ref" : "apiId"},
          "AutoDeploy": true,
          "Description": "Default stage",
          "StageName": "$default"
        }
      }
    },
    "Outputs": {
      "stageName": {
        "Description": "The API Gateway stage name",
        "Value": {
          "Ref": "apiStage"
        }
      }
    }
  }

I am using this CFTs to create the log group and passing as parmater in the API stage but I am receiving this error as Insufficient permissions to enable logging

Help me out what all permissoins need to add

질문됨 7달 전209회 조회
1개 답변
0

Hello.

API Gateway logging requires the permissions listed in the following documentation:
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html

profile picture
전문가
답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠