Fetch Amazon Web Services (AWS), Datadog and DigitalOcean usage directly from Slack using Nimbella Commander.
These commands are intended for use with Nimbella Commander. Please install Commander in your Slack team first. Next, install this command set into your workspace by running the following command.
/nc csm_install billingTo run the below commands, we need API access tokens for respective services. See Requirements section of each command to learn more.
We need three secrets named awsCostExplorerAccessKeyId, awsCostExplorerSecretAccessKey, and awsCostExplorerRegion.
Watch this video to learn how to create AWS access keys. And while creating the access keys, create a policy using the below JSON to limit the access to Cost Explorer service.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ce:DescribeCostCategoryDefinition",
"ce:GetRightsizingRecommendation",
"ce:GetCostAndUsage",
"ce:GetSavingsPlansUtilization",
"ce:GetReservationPurchaseRecommendation",
"ce:ListCostCategoryDefinitions",
"ce:GetCostForecast",
"ce:GetReservationUtilization",
"ce:GetSavingsPlansPurchaseRecommendation",
"ce:GetDimensionValues",
"ce:GetSavingsPlansUtilizationDetails",
"ce:GetCostAndUsageWithResources",
"ce:GetReservationCoverage",
"ce:GetSavingsPlansCoverage",
"ce:GetTags",
"ce:GetUsageForecast"
],
"Resource": "*"
}
]
}The values of awsCostExplorerAccessKeyId, awsCostExplorerSecretAccessKey, and awsCostExplorerRegion should be your Access Key ID, Secret access key and your AWS region code respectively.
/nc awsbillTo get notified when the bill exceeds a certain amount, follow the instructions below.
-
Create a secret named
awsCostThresholdwith your budget.Run
/nc secret_createand follow the instructions.The value should be a number without your currency unit. ✅
100❌$100Note: we recommend you to set the budget a bit lesser than your actual budget since Cost Explorer API is delayed by a day.
-
Setup your Slack channel with Commander
Follow this guide.
-
Create a Commander task
-
Run
/nc task_create awsbill #general awsbill -taskto create a task.Replace
#generalwith the slack channel you added to commander. -
Run
/nc task_rate awsbill 1 minuteto set your task rateThis sets the task to run every minute. Learn more here.
-
Run
/nc task_start awsbillThis will start the task and now whenever the bill exceeds the set threshold, you'll get a message in your channel.
-
We need two secrets named datadogApiKey with your Datadog API key and datadogApplicationKey with your Datadog Application key to run this command. You can learn about them here.
To see projected cost of this month and next month:
/nc datadogbillTo see a detailed breakdown of costs, pass -detail flag.
/nc datadogbill -detailWe need a Nimbella Commander secret named digitaloceanApiKey with your DigitalOcean Personal Access Token to able to run this command. Follow this guide to obtain your Personal Access Token.
To create the secret, you need to type /nc secret_create inside your Slack workspace and follow the instructions.
/nc dobill