Creating an AWS billing alarm is pretty straightforward, and you should really use it. You can avoid "surprise bills" at the end of the month.
For further details reads this post.
For simple cost management, aws can automagically email if aws bills exceed a limit. Instead the manual procees of creating resources, use the provided CloudFormation template.
- Start the Create Stack on AWS console:
- On the Select Template page click Next
- On the Specify Details page fill the Email and Spending Limit fields, than click Next
- On the Options page click Next
- On Review page click Create
You will receive an email from : AWS Notifications <[email protected]>
:
- Click on the Confirm subscription link
If you prefer the terminal way:
export [email protected]
export BILLING_ALARM_LIMIT=123
aws cloudformation create-stack \
--template-url https://s3-eu-west-1.amazonaws.com/lp-lambda-go/billing-alarm.yml \
--region us-east-1 \
--stack-name billing-alarm \
--capabilities CAPABILITY_IAM \
--tags Key=alarm,Value=billing \
--parameters \
ParameterKey=BillingAlertEmailParameter,ParameterValue=${BILLING_ALARM_EMAIL} \
ParameterKey=MonthlySpendLimitParameter,ParameterValue=${BILLING_ALARM_LIMIT} \
ParameterKey=AlarmEvaluationPeriod,ParameterValue=one-hour
If you want to manually do the steps on the AWS console follow this description