Monitoring and Alerting for AWS Billing and Costs

  Uncategorized

Main Menu

Section Menu

Monitoring and Alerting for AWS Billing and Costs

https://www.udemy.com/aws-monitoring-alerting-with-aws-cloudwatch-and-aws-sns/learn/v4/t/lecture/7082708?start=0

Introduction

  • Cloud computing provides an advantage over dedicated hardware in that you can avoid fixed upfront costs and only rent out the compute power required.
  • Without monitoring the cloud costs closely, it is possible to accidentally end up with a huge bill.
    • To avoid these cost over runs, AWS provides functionality to monitor the billing and estimated costs for the account.
    • You can also setup alarms on these costs to alert you as ou incur unexpected costs for your infrastructure.

Understanding AWS Billing and Costs

  • AWS is a public cloud service which runs on a Pay-As-You-Go model.
    • You only pay for the services you use.
    • Once you finish using a resource, you can deallocate them from the account and you will no longer be obligated to pay for them afterwards.
  • This type of billing plan requires users to be extremely cautions and monitor the billing as effectively as possible.
    • Since it is so convenient to allocate new resources, this can backfire if deploying more resources than are required.
    • It is also possible to fail to deallocate resources when you’re done using them.
  • Other bills may come from a lack of understand on how resources are charged.
    • EC2 instances stop accruing charges when the VM is stopped or deallocated.
    • EBS volumes attached to these VMs continue to incur costs until they are deallocated, regardless if the VM is stopped or has been deallocate. (Unless the volume has been flagged to be deallocated upon termination of the VM.)
  • The costs and billing can be tracked by AWS (cc: “the police” hahaha!) and by monitoring and analyzing this billing data, the users can also develop insights into their cloud usage and leverage this information to optimize their could resource usage.
    • Great for companies with resources across multiple Regions and AZs

Specifics

  • Only the root account has access to billing alerts
    • Cannot be delegated to any other IAM user 🙁
  • Alerts can be received
    • Email with PDF invoices
    • CloudWatch Alarms
      • Must first be enabled
    • Billing reports that are stored in an S3 bucket

Monitor AWS Billing

https://www.udemy.com/aws-monitoring-alerting-with-aws-cloudwatch-and-aws-sns/learn/v4/t/lecture/7082710?start=0

Demo

  • Username > My Billing Dashboard > Preferences
    • Receive PDF invoices by Email
      • Sent within the first 3 days of every month
      • Very granular
    • Receive Billing Alerts
      • Must be checked to monitor metrics and create alarms
    • Receive Billing Reports
      • Select the S3 bucket

Enable Alerts

  • Switch to N. Virginia Region
    • All billing metrics are aggregated here
    • Billing metrics are NOT available in any other region
  • View Metrics: CloudWatch > Metrics > Billing > All metrics
    • By Service
    • Total Estimated Charge
      • Can be used to setup an alarm when the total billing crosses a specific threshold
      • Recommended to setup an alarm at ~90% of estimated spend
        • to allow time to clean up unnecessary resources.
        • Prevent cost overruns
  • Create Alarm: CloudWatch > Alarms – Billing > [Create Alarm]
    • Metric > [Select metric] > All metrics tab > Billing > Total Estimated Charge > [x] EstimatedCharges > [Select metric]
    • Billing alarm: When my total … exceed: 15
    • Send a notification to: NotifyMe
    • [Create Alarm]

Receive AWS Billing Reports

https://www.udemy.com/aws-monitoring-alerting-with-aws-cloudwatch-and-aws-sns/learn/v4/t/lecture/7082700?start=0

Enable billing reports

  • Create an S3 bucket and save the name
  • My billing dashboard > Preferences
    • [x] Receive billing reports
    • Save to S3 bucket: yourbucketname
      • if you click Verify now you’ll see the bucket is invalid. It needs the correct permissions first.
    • Get the permissions JSON to allow saving to the bucket by clicking on the link for ‘sample policy’ and copy its contents to the clipboard.
  • Enable correct permissions
    • S3 > Select bucket > Permissions > Bucket policies > Paste the JSON code from the ‘sample policy’ > [Save]
  • My billing dashboard > preferences > Receive billing reports > [Verify]
    • Monthy report
    • Detailed billing report
    • Cost allocation report
    • detailed billing report with resources and tags

2:27

 

 

 

 

LEAVE A COMMENT