Sends daily breakdowns of AWS costs to a Slack channel.
-
Create an incoming webhook that will post to the channel of your choice on your Slack workspace. Grab the URL for use in the next step.
-
Deploy the system into your AWS account, replacing the webhook URL below with the one you generated above.
SLACK_WEBHOOK=https://hooks.slack... npm run deploy
-
You can also run it once to verify that it works:
npm run invoke
If you have AWS credits on your account and want to see them taken into account on this report, head to your billing dashboard and note down the "Expiration Date", "Amount Remaining", and the "as of" date towards the bottom of the page. Add all three of these items to the command line when executing the deploy
or invoke
:
```
serverless deploy \
--param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
--param "credits_expire_date=mm/dd/yyyy" \
--param "credits_remaining_date=mm/dd/yyyy" \
--param "credits_remaining=xxx.xx"
```
If you have and AWS Organisation established and would like to see a breakdown by account, you can override the default dimensions with parameters:
```
serverless deploy \
--param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
--param "group=LINKED_ACCOUNT" \
--param "group_length=15"
```
Possible value for group
are:
- AZ
- INSTANCE_TYPE
- LINKED_ACCOUNT
- OPERATION
- PURCHASE_TYPE
- SERVICE
- USAGE_TYPE
- PLATFORM
- TENANCY
- RECORD_TYPE
- LEGAL_ENTITY_NAME
- INVOICING_ENTITY
- DEPLOYMENT_OPTION
- DATABASE_ENGINE
- CACHE_ENGINE
- INSTANCE_TYPE_FAMILY
- REGION, BILLING_ENTITY
- RESERVATION_ID
- SAVINGS_PLANS_TYPE
- SAVINGS_PLAN_ARN
- OPERATING_SYSTEM
By default, AWS_PROFILE
and AWS_REGION
are defaulting to default
and us-east-1
. These value can be changed by modifying the environment. For aws account, sensible default is attempted to be retrieved. For example, boto3 is used to try and determine your AWS account alias if it exists, and if not your AWS account ID.
Additionally, for your AWS region the environment variables AWS_REGION
, then AWS_DEFAULT_REGION
are read and used if present, otherwise fallback to 'us-east-1' (N. Virginia).
```
AWS_PROFILE="default" AWS_REGION="eu-west-1" serverless deploy \
--param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
--param "aws_account=my custom account name"
```
By default we show the unblended costs, but if you set the environment variable COST_AGGREGATION
to something else, you can change the cost aggretation AWS uses.
Possible values are: AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity.
More information is available at the Metrics request parameter here