Interact with Amazon Web Services from messaging platforms like Slack, Mattermost & Microsoft Teams using Nimbella Commander.
Please make sure Commander is installed in your Slack workspace before executing this Slash command.
/nc csm_install aws
We need three secrets named awsAccessKey
, awsSecretKey
, and awsRegion
for all commands excluding route53
and awsbill
.
Watch this tutorial to learn how to create AWS access keys. And while creating the keys, please make sure they have permissions to interact with EC2, DynamoDB, and RDS services.
The values of awsAccessKey
, awsSecretKey
, and awsRegion
should be your Access Key ID, Secret access key and your AWS region code respectively.
route53
To use route53
commands, create three secrets named route53AccessKey
, route53SecretKey
, route53ZoneId
with values being your Access Key ID, Secret access key and Route 53 Zone Identifier respectively.
awsbill
To use awsbill
, We need three secrets named awsCostExplorerAccessKeyId
, awsCostExplorerSecretAccessKey
, and awsCostExplorerRegion
.
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.
awsbill
- Fetch AWS bill.ec2_list
- List EC2 instances in the provided region.ec2_reboot
- Reboot an EC2 instance.ec2_status
- Know the status of EC2 instances.dynamodb_list
- List Database tables.rds_list
- List Amazon RDS (Relational Database Service) instances under your account.route53_list
- List AWS route53 managed hostnames.route53_add
- Add AWS route53 hostname.
Shows your AWS bill.
/nc awsbill [<monthYear>] [-task <task>]
To get notified when the bill exceeds a certain amount, follow the instructions below.
-
Create a secret named
awsCostThreshold
with your budget.Run
/nc secret_create
and follow the instructions.The value should be a number without your currency unit. ✅
100
❌$100
Note: 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 -task
to create a task.Replace
#general
with the slack channel you've added to commander. -
Run
/nc task_rate awsbill 1 hour
to set your task rateThis sets the task to run every hour. Learn more here.
Note: AWS charges $0.01 for each request made to AWS Cost Explorer API. So please keep that in mind while setting the task rate.
-
Run
/nc task_start awsbill
This will start the task and now whenever the bill exceeds the set threshold, you'll get a message in your channel.
-
Lists your EC2 instances in the provided region.
/nc ec2_list [<substr>]
Reboot your EC2 instance.
/nc ec2_reboot <id>
Know the status of your EC2 instances.
/nc ec2_status <id>
List DB Tables under your account.
/nc dynamodb_list [<startTable>]
List Amazon RDS (Relational Database Service) instances under your account.
/nc rds_list
Lists AWS route53 managed hostnames
/nc route53_list [-type <record_type>] [-match <match_string>]
Adds an AWS route53 hostname
/nc route53_add <hostname> <ip_address>
We're always happy to help you with any issues you encounter. You may want to join our Slack community to engage with us for a more rapid response.