Is it possible to access cross-account cloudwatch metrics programatically using CloudWatchClient - node.js

I've followed the Cross-Account Cross-Region Cloudwatch console tutorial and am able to see cloudwatch metrics from my other AWS account in the cloudwatch console.
Am I able to query these metrics using GetMetricStatisticsCommand when using credentials of my new AWS account? (i.e. the account that did not produce these metrics)
Any help would be massively appreciated as I can't see any documentation in the CloudwatchClient about achieving this.
Thanks!

Related

Accessing CloudFront metrics from another account

I have 2 AWS accounts:
QA account,
monitoring account.
First one has a CloudFront distribution. I can see its metrics in CloudWatch in the same account.
In the same CloudWatch, I have enabled cross-account cross-region data sharing with the second - monitoring account.
Unfortunately, from the CloudWatch in the monitoring account, I cannot see any CloudFront metrics. Tried in the us-east-1/N.Virginia region, where CF supposed to expose its metrics, but I cannot see them. At the end, I would like to access CloudFront metrics from the first account while being in Ohio region in the monitoring account.
Could you please guide me, how to access those CloudFront metrics from a perspective of the second account?
Thanks in advance!
Using AWS Management Console for the second account, I tried to explore all CloudWatch metrics from different regions looking for CloudFront data, including N.Virginia, but could not find anything.
OK, fixed. Now, while adding widgets to CW dashboard in the monitoring account I can see 2 drop-down boxes with account and region. When I select QA account and N.Virginia region, I can see all required CloudFront metrics to choose from.
I am not 100% sure, why it helped, but that's what I did: I have re-configured CloudWatch->Settings->View cross-account cross-region again, but this time selected Custom account selector instead of Account Id Input.
Initially, I first enabled viewing data from the monitoring account and then enabled sharing data from the QA account. Maybe it has to be done in the reverse order to work from the git go.
Anyway, I hope it will help someone struggling like me.

aws boto3 python - get all resources running

i am trying to connect to an aws region and want to find all resources running in that. the resources can be any thing from the list of services provided by aws (ec2, rds...). Now that i am writing python code to create a client for every service and getting the list. if i have to write the code for all services, it will be huge. please suggest me a best approach to grab the details with python. i cant use the aws config or resource manager as these are not whitelisted yet.

AWS boto3 billing information

I'm looking for a way to extract billing information using boto3. I've seen solutions using cost explorer but it's not a choice in my case. The information I want to extract is on Billing Dashboard > Bills. Is there a service on boto3 that facilitates this task?
I found a solution, using boto3. Using the CloudWatch client we can extract Billing metrics for any service we want:
Monitor Estimated Charges with CloudWatch
CloudWatch.Metric.get_statistics

Payload logging on AWS SageMaker

How can I enable monitoring and log payload for a model deployed on AWS SageMaker? I am using a classification model and will be outputting predicted class and confidence. How should i configure this in UI or sdk?
The configuration process in UI:
Click second tab on the left and select AWS SageMaker
Provide the access key info and the region of the AWS SageMaker
Select the deployment(s) you want to monitor
Use the code snippet provided in a Watson Studio notebook to set up the payload schema.
Configure the fairness and accuracy monitors in the UI. This step should be the same as configuring deployments from any other environments (e.g. WML, SPSS)
SageMaker sends all logs produced by your model container to your CloudWatch, under log group named /aws/sagemaker/Endpoints/[EndpointName]. With that said, you could simply configure your model to log inference payloads and outputs, and they will show up in CloudWatch logs.

Custom Cloudwatch Metrics

I am using AWS RDS SQL server and I need to do enhanced level monitoring via Cloudwatch. By default there are some basic monitoring available but I want use custom metrics as well.
In my scenario I need to create an alarm whenever we get more number of deadlock in SQL server. We are able to fetch the details of deadlock via script and I need to prepare custom metrics for the same.
Can any one help on this or kindly suggest any alternate solution?

Resources