I created a lambda function to upload files to s3. When testing via the AWS interface, everything works. Next I created the API Gateway and tried to make a request through ReactJs. But I get an error. I want to see what error occurs but I cannot add logs to the API Gateway. What I do.
Try to activate checkbox Enable CloudWatch Logs but got CloudWatch Logs role ARN must be set in account settings to enable logging
Create role in IAM with next policy: AmazonS3FullAccess, AmazonAPIGatewayPushToCloudWatchLogs, AWSLambdaBasicExecutionRole
Copy the Role ARN
The role ARN does not have required permissions set to API Gateway
.Can you tell me what other settings I need?
This is because API Gateway creates log groups or log streams for an API stage at the time when it is deployed. To use the Amazon Web Services Documentation, Javascript must be enabled.
To view API Gateway logs, log in to your AWS Console and select CloudWatch from the list of services. Select Logs from the left panel. Select the log group prefixed with API-Gateway-Execution-Logs_ followed by the API Gateway id. You should see 300 log streams ordered by the last event time.
According to this documentation (https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/) after creating the Role, you need to add it to the Global AWS Api Gateway Settings (when you open the Console, there is a settings menu in the left pane) as the CloudWatch log role ARN.
Then it will use that role for all the gateways you create, so this is a one-time step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With