- Mais recentes
- Mais votos
- Mais comentários
I just want to suggest a few troubleshooting. It seems like you want to capture 5xx errors from API Gateway using EventBridge and then send notifications via an SNS topic (If I get your question correctly).
Here's how you can achieve this:
-
Lambda Function:
You already have a Lambda function that generates a 503 error. Ensure that this Lambda function has the necessary permissions to be triggered by API Gateway.
-
API Gateway Integration:
Make sure your API Gateway is configured to integrate with your Lambda function for the respective resource/method that will generate the error.
-
Create an SNS Topic:
If you haven't already, create an SNS topic that will be used to send notifications.
-
EventBridge Rule:
- Go to the Amazon EventBridge service in the AWS Management Console.
- Create a new rule:
- Event Source: Choose "Event Source = AWS API Gateway".
- Specific service(s): Select the API Gateway you want to monitor.
- Event Type(s): Choose "ApiGateway" and "ApiCall".
- Event pattern:
{ "detail": { "responseElements": { "httpStatus": ["5xx"] } } }
- Targets: Add a target, and select the SNS topic you created earlier.
-
Deploy the API Gateway:
Make sure your API Gateway is deployed and the respective method/resource is accessible.
-
Generate the Error:
By accessing the API method that triggers the Lambda function and returns a 503 status code, generate the error condition.
-
Check SNS for Notifications:
- Go to the Amazon SNS service in the AWS Management Console.
- Navigate to the topic you created.
- You should see notifications related to the 5xx error that was triggered.
NOTE
- The event pattern provided in step 4 filters the events to only capture responses with 5xx status codes. You can further customize the pattern if needed.
- Ensure proper IAM roles and permissions are set up for Lambda, API Gateway, EventBridge, and SNS.
- Make sure your Lambda function is returning the desired 503 status code.
- Be aware of the potential cost implications of setting up and triggering these resources.
Always consider best practices for security and monitoring when implementing such integrations. This approach should allow you to capture 5xx errors from API Gateway and receive notifications via SNS when those errors occur.
ur answer is not working in practical
Conteúdo relevante
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 3 anos
Can you elaborate some more on the flow and exactly what you want to achieve? It is not clear to me from the question.