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

gefragt vor 7 Monaten209 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 7 Monaten

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