- Newest
- Most votes
- Most comments
Programmatic access to AWS Health API requires the calling account to have a Business, Enterprise On-Ramp, or Enterprise Support plan. Accessing AWS Health is free through the AWS Health Dashboard and through Amazon EventBridge. You can use the latter to monitor events for Transcribe by configuring an EventBridge rule that catches events for Amazon Transcribe and then triggering your lambda. If you want to go down the programmatic access route, I'd recommending looking into AWS Health Aware, which also requires Business or Enterprise support, but will have some good examples for for you to follow (see github project), which supports pushing events to a number of channels that you can configure.
Hi,
The event bridge rule is created like the one in the doc you shared. Event Source: AWS events or EventBridge partner events Event pattern: Event source -> AWS service >> Health >>> Specific health event Select Target: I believe I should select the Lambda function that I shared in the question.
Can you please explain with a bit more clarity when you say-
- configuring an EventBridge rule that catches events for Amazon Transcribe and
- then trigger your lambda.
Thanks in advance
For your reference: Screenshot for the CloudWatch metrics when the event bridge rule is set for the Transcribe service with a lambda function.
You added an answer to your own question, if you want to follow up on a question I will probably be better to add a comment to my question :) (1) When you configure the rule you can select the service you are interested from a drop down list. You can follow the guide I linked, the provided example is for catching EC2 events, but it will work exactly the same for Transcribe. (2) After you have configured the rule, any AWS Health event posted for Amazon Transcribe that reaches your account invoke the target that you have configured in the rule. It looks like you want to write the output to S3, so you can do that by invoking your Lambda function when an event is received. The guide I linked also has an example of the payload.
Hi iddv, based on the suggestion (1) when I configure the even bridge rule, I can select the service I am interested in from a drop-down list. The service in my case is Transcribe - Done (2) After I have configured the rule, any AWS Health event posted for Amazon Transcribe that reaches my account invokes the target that I have configured in the rule - Done (3) I want to write the output to S3, so I can do that by invoking my Lambda function when an event is received - Done.
Lambda function looks like this:
import json import boto3 def lambda_handler(event, context): s3 = boto3.client('s3') bucket_name = 's3bucket' key = 'aws-health-events/{}.json'.format(context.aws_request_id) event_data = json.loads(event['detail']) # Extract relevant information from the AWS Health event event_description = event_data['eventDescription'][0]['latestDescription'] event_status_code = event_data['statusCode'] event_start_time = event_data['startTime'] event_end_time = event_data['endTime'] # Upload the event information to S3 s3.put_object(Body=event_description, Bucket=bucket_name, Key=key) return { 'statusCode': 200, 'body': json.dumps('AWS Health event successfully processed') }
Observations:
- I can see some runtime metrics that lambda sends. But I'm unsure how to read it. Please refer the screenshot I've attached for your reference in the post above.
- I Can't see any file in the S3 bucket
The metrics that you've posted seems to indicate that your function was invoked successfully once. There are a couple of things that you can do to debug this, such as (1) verify that you've deployed the latest version of your function, (2) make sure to test your function with a valid sample event, (3) add some debug logging to your code to verify that your code is doing what you expect it to do and (4) verify that your function has the correct permissions. Once you have it working with a sample event, you can log a request with AWS Support through the console to send a test event to your account, that will test your function end to end with a real AWS Health Event!
Thanks for the quick reply :) I am not looking to fix this programmatically. I will try your recommendation to go with EventBridge now.
Relevant content
- asked 2 years ago
- asked 3 years ago
- Accepted Answerasked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 4 months ago
Just a note, AWS Health Aware also uses the Health API (and the related Business or Enterprise Support plan enabled on each account)
That is correct, I just mentioned it because it might serve as a good example. I've updated my answer to clarify.