AWS Cloudwatch billing notification every $50 - amazon-web-services

I want to have a notification on every $50 increase in billing.
Right now, I am using EstimatedCharges as my metric, and I wanted to have an alarm on every $50 increase.
For example: [$10, $20, $31, $50, $61, $110].
I want it to be in an alarm state when it reaches the $50 mark, $100, and so on...
Is this even possible using only cloudwatch metric math?

Related

To find underutilized instances list based on CPU and network utilization

I would like to get all the AWS EC2 instances list which are idle and underutilized. I need to filter them based on CPU utilization used less than 2% and network I/O less than 5Mb for last 30 days.
Can you please provide me with the commands or any scripts to get the list or guide me to get that achieved.
I need this to get that list and terminate those instances for cost management.
You can create a CloudWatch alarm that is triggered when the average
CPU utilization percentage has been lower than 2 percent for 24 hours,
signaling that it is idle and no longer in use. You can adjust the
threshold, duration, and period to suit your needs, plus you can add
an SNS notification so that you will receive an email when the alarm
is triggered.
Kindly refer to this documentation to create an alarm to terminate an idle instance using the Amazon CloudWatch console.

Cloudwatch for billing alarm in daily based using cloudwatch metric

May I ask is there any way that I can make a billing alarm for a daily based cost via cloudwatch metric?
I know that billing alarm is in monthly basis. Is there a possiblity that I can create a custom metric to get the daily cost then set a threshold let say if I spend $2 on AWS Lambda service it will trigger and notify via sns.
Thanks! Any help would be appreciated.
You can use the AWS Cost Explorer API to programmatically retrieve cost and usage metrics for your account. You can query for aggregated data such as total monthly costs or total daily usage, but you can also query for granular data.
To solve your requirement, you could set up a scheduled CloudWatch Event that triggers a Lambda, which in turn analyzes (and reports on) the cost and usage data from the previous day or get the cost forecast for a specified time period in the future.
Here's the AWS Cost Explorer API Documentation.

AWS - False Billing Alert at 0.00 USD - at start of the Month

I have a billing Alarm set as Whenever charges for: EstimatedCharges is: >=USD $100
So i assume - The alarm should trigger when my Billing cost is above 100USD.
But early today i had a Billing Alert for my Alarm
That said
The alarm limit you set was $ 100.00 USD. Your total estimated charges accrued for this billing period are currently $ .00 USD as of
Saturday 01 December, 2018 11:24:23 UTC
But when I checked CloudWatch the alarm state is OK
State changed to OK at 2018/12/01. Reason: Threshold Crossed: 1 out of
the last 1 datapoints [0.0 (01/12/18 05:24:00)] was not greater than
or equal to the threshold (100.0) (minimum 1 datapoint for ALARM -> OK
transition).
For each alarm, you can set up 3 types of alert depending on the alarm state (OK, ALARM, INSUFFICIANT_DATA).
When you first create an alarm, its initial state is INSUFFICIANT_DATA. Then, depending on the metric value, threshold and period, it will reach the OK or ALARM state.
If you have set up notifications for all the different states, it's normal that you get a notification as well when the alarm went back from ALARM (end of a month over 100$) to OK state (new month - new bill).
If you don't want to get notifications when billing is under 100$, just remove the OK notification that you have set up:
Hope it helps!

AWS CloudWatch Zero Queue Size For One Week alarm

I am wondering if there is a way to set up a CloudWatch alarm that will alarm if an SQS queue has not received any traffic for 7 days. I currently have a job that runs on my host once a week that is guaranteed to add message to my SQS queue, I already have a way of alarming if the job doesn't run but I would also like to alarm if for some reason the job does run but does not send any messages to my queue. I understand that the longest alarm period you can set is 1 day. Is there another way to create an alarm that will do what I am looking for?
Edit:
Since my job runs once a week is there a way to have an alarm that will monitor metrics every 7th day, seeing if any traffic hits the queue within a 24 hour time frame? This is more accurate seeing as the 6 days in between I don't expect or care if there is any traffic only that there is traffic on that 7th day.
CloudWatch Alarms set a limit that period * number_of_datapoints_to_watch must be less than 24 hours. As far as I know, there is no way around that.
To get the behavior you want, you can calculate days since last activity yourself, publish that as a custom metric and alarm on that.
One way to do it would be:
Create a lambda function and have it trigger every hour for example.
In the lambda, call CloudWatch GetMetricStatistics for the SQS metric you want to monitor.
Get the latest datapoint returned that has value greater than 0 and calculate the difference between now and the timestamp on that datapoint.
Use CloudWatch PutMetricData to publish this value to your new metric days-since-last-activity.
Now you can alarm when the value of your new metric goes above 7 days.

Charge variable amount to subscription in authorize.net?

How can charge additional variable amount to subscription any time on authorize.net?
Through subscription, fixed amount can be charged to user subscription, whether there is a way, we can charge variable amount to subscription at any day until subscription is active?
Suppose I set amount $20 on every 10th of month to be charged from customer through recurring billing. Suppose, now I want $10 to be charged to customer on 2nd of month for other reason through his subscription, whether there is API available for that additional money to be charged?
There is no way to do this with their ARB subscription API. You would need to combine CIM, which let's you create payment accounts on Authorize.Net's server, with your own payment engine. Then you can charge someone whatever you want, whenever you want, all while reducing your PCI scope.