Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 6.39 KB

AWS-costs.md

File metadata and controls

88 lines (57 loc) · 6.39 KB

AWS Costs

Trusted Advisor

Use the Trusted Advisor to identify instances that you can potentially downgrade to a smaller instance size or terminate. Trusted Advisor is a native AWS resource available to you when your account has Enterprise support. It gives recommendations for cost savings opportunities and also provides availability, security, and fault tolerance recommendations. Even the simplest tunings, such as to CPU usage and provisioned IOPS can add up to significant savings.

On the TA dashboard, click on Low Utilization Amazon EC2 Instances and sort the low utilisation instances table by the highest Estimated Monthly Savings.

Billing & Cost management

You can use the Bills and Cost explorer to understand the breakdown of your AWS usage and possible identify services you didn’t know you were using it.

Unattached Volumes

Volumes available but not in used costs the same price. You can find them in the EC2 console under Volumes section by filtering by state (available).

Unused AMIs

Unused AMIs cost money. You can clean them up using the AMI cleanup tool

Unattached EIPs

Unattached Elastic IP addresses costs money. You can find them using the trust advisor, or looking at your bills as they are free if they are attached (so in use).

DynamoDB

You should frequently review the reserved capacity of all your dynamodb tables to make sure it's not over-committed. The easiest way to do this is to select the Metric tab and check the Provisioned vs. Consumed write and read capacity graphs and use the Capacity tab to adjust the Provisioned capacity accordingly. Make sure the table capacity can handle traffic spikes. Use the time range on the graphs to see the past weeks usage.

Cloudwatch

Cloudwatch metrics can become really expensive without being used at all. Apart from your app metrics, you can configure some AWS SDK to send the metrics you are using, for instance for kinesis.

S3

S3 may looks cheap, but the management console does not help you to understand what is inside each bucket and the size of each own. You can follow the storage size of each of your buckets from a cloudwatch metric called BucketSizeBytes. It is good idea as well to have a look the different storage classes available for your data:

  • Infrequent access

Lower storage price, higher access price. Interesting for backups for instance.

Lower storage price, reduced redundancy. Interesting for reproducible data or non-critical data such as logs.

  • Glacier

Extremely low storage price, very high access price. Interesting for data to archive but almost never retrieved.

Another useful feature to manage your buckets is the possibility to set lifecycle policies to change the storage class or delete objects in the buckets or on a path of the bucket.

Getting rid of incomplete multipart upload

S3’s multipart upload feature accelerates the uploading of large objects by allowing you to split them up into logical parts that can be uploaded in parallel. However if you initiate a multipart upload but never finish it, the in-progress upload occupies some storage space and will incur storage charges. And the thing is these uploads are not visible when you list the contents of a bucket through the console or the standard api (you have to use a special command)

There are two ways to solve this now and prevent it from happening in the future:

An example of how to cloud-form the lifecycle rule:

  UploadBucket:
    Type: "AWS::S3::Bucket"
    Properties:
      BucketName: "upload-bucket"
      LifecycleConfiguration:
        Rules:
          - AbortIncompleteMultipartUpload:
              DaysAfterInitiation: 7
            Status: Enabled

Bandwidth

Compress the outgoing traffic. New AWS instance types often have cost savings potential.

Reservations

Identify instances that you plan to continuously run for the foreseeable future and that you consider the core of your application. These core instances are a good candidate to reserve. You can see savings of over 50% on reserved instances vs. on-demand instances. More info on reserving instances.

Reservations are set to a particular AWS region and to a particular instances type. Therefore, after making a reservation you are committing to run that particular region/instances combination until the reservation period finishes, or you will swipe off all the financial benefits.

Spot Instances

If your application can handle occasionally being shut down, with short notice, spot instances are generally much cheaper. Often instances are availabe almost all the time for 10-20% of the standard price making them notably cheaper than reserved instances. Spot fleet should make it to the point where you're very unlikely not to have the capacity you need, though at the time of writing, it's not supported in CloudFormation.