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.
Related
We use AWS Cloudwatch Metrics and the associated dashboards a lot. Sometimes we want to add a new visualisation, but now we can only find the metric from our first PutMetricData onwards. We however often have the data retrospectively, just not uploaded at the time.
Can you retrospectively upload metrics to Cloudwatch?
I am looking for a programmatic way to monitor my lambda serverless environment cost in real time, or x hours retrospective. I am looking at the budget API but it seems like it always goes around a defined budget which is not my use case. The other way I thought might work is the count lambda executions and calculate according to lambda instance type. Any insight or direction how to go about this programmatically would be highly appreciated.
From Using the AWS Cost Explorer API - AWS Billing and Cost Management:
The Cost Explorer API allows you to programmatically query your cost and usage data. You can query for aggregated data such as total monthly costs or total daily usage. You can also query for granular data, such as the number of daily write operations for DynamoDB database tables in your production environment.
Cost Explorer refreshes your cost data at least once every 24 hours, so it isn't "real-time".
I want to understand what is the difference between using Budgets(cost budget) and Configure Billing Alerts in AWS?
Billing Alerts are very limited as compared to Budgets. Most notably, the billing alarm represents only the amount you have been already charged. In contrast, a budget can alarm you based on forecasted charges, which can give you a bit of head up to figure out what's happening before you get hit with excess bill usage.
The other key difference is that Budgets allow you to create filtered alarms, only for some regions and services of interest. Filtering by region is not possible with billing alerts. Another thing is that budget support linked accounts, which again is not possible with the billing alerts.
Finally, budgets are far easier to use, set up and manage, than billing alerts.
Well, other power of the Budget as:
Filter by multiple dimension: Region, Service Type, Instance Type, AZ, Tag, linked account, etc...
Budget can take action (Ex: Stop EC2)
Note: CloudWatch can take action if you trigger a lamda function.
Notification preferences - Optional
You can select 1 or more notification preferences to receive alerts: Email, SNS Alert.
I'm new and am trying to work with AWS. I develop small lambda functions and have created some dynamodb tables. I don't expect there to be any costs, because I should be in the free-tier, but since last month I am seeing costs for "Cloud Watch Alarms". Not high costs, but I got billed $0.53. Why I am getting this bill even though I am using AWS free tier.
Billing info:
$0.00 per alarm-month - first 10 alarms 10 Alarms $0.00
$0.10 per alarm-month 4.277 Alarms 0.43$
I don't want these cloudwatch metrics right now. I only want to store log files. How can I to disable these cloudwatch metrics.
Thanks,
You have configured, maybe unintentionally, a Cloud Watch Alarm.
Fortunately it's quite easy to remove it.
Go to your AWS Dashboard and select Cloud Watch:
On the left-hand side, click on Alarms. Select the Alarm which you want to remove and delete it.
This is what I got from AWS Support:
CloudWatch collects and processes raw data from DynamoDB into readable, near real-time metrics. These statistics are recorded for a period of two weeks, so that you can access historical information for a better perspective on how your web application or service is performing. By default, DynamoDB metric data is sent to CloudWatch automatically.
When you interact with DynamoDB, it sends the following metrics and dimensions to CloudWatch. Note that Amazon CloudWatch aggregates the following DynamoDB metrics at one-minute intervals:
> ConditionalCheckFailedRequests
> ConsumedReadCapacityUnits
> ConsumedWriteCapacityUnits
> ReadThrottleEvents
> ReturnedBytes
> ReturnedItemCount
> ReturnedRecordsCount
> SuccessfulRequestLatency
> SystemErrors
> TimeToLiveDeletedItemCount
> ThrottledRequests
> TransactionConflict
> UserErrors
> WriteThrottleEvents
I'm trying to find out if there is a way to turn this off and will update my answer when I get it
Well you can do that via SCP's to sit a generic policy to deny such api
It looks like custom metrics will be kept for 15 months, if I understand it correctly, since they get aggregated to higher resolution, according to https://aws.amazon.com/cloudwatch/faqs. Does it mean we have to pay for at least 15 months once we create a custom metric?
I have CloudWatch agent installed to collect various metrics using user_data. It creates new metrics for every new instances. After running many tests, I have more than 6,000 custom metrics, but most of them are unused. Since there is no way to delete custom metrics, do I get charged for those unused metrics until they expire (15 months)? I hope I'm wrong on this :]
Please clarify how we get charged for unused custom metrics.
You will not get charged for those. You will get charged for the metric for the duration you publish data onto them. It's not very clear on the CloudWatch pricing page but they hint it in the [original pricing reduction blogpost]{https://aws.amazon.com/blogs/aws/aws-price-reduction-cloudwatch-custom-metrics/).
You will get charged though on the retrieval of those (API costs).
we have the same issue to resolve. waiting for clearification from aws