e-Zest members share technology ideas to foster digital transformation.

AWS Programmatic Billing Access

Written by Sandeep Dhawale | Jul 6, 2012 2:49:49 PM

When to use programmatic billing access

Programmatic Billing Access advantages excising Amazon Simple Storage Service (Amazon S3) APIs so you can build applications that reference your billing data from a CSV (comma separated value) file stored in an Amazon S3 bucket.

Steps programmatic billing access as follows -
  1. Log in to Amazon Web portal http://aws.amazon.com/
  2. Then click on My Account/ Console Tab. Select My Account you will get Amazon Web Services Sign in window as follows - You may sign in using your existing Amazon.com account and password. (Put your username and password and click on Sign in using Our Server Security Tab)
  3. You will get Access to your AWS Manage Account.
  4. After login into AWS click on My Account/ Console Tab and Select Account Activity Tab. You will get following Window
  5. In Open Window Select Billing Preferences TAB As follows
  6. If you have access on Billing Preferences TAB then you will get following window, and if you have already enabled CSV report for your billing statement
  7. If you haven’t enabled CSV report then you need to enable CSV Report by Sign up for Programmatic Billing Access by providing a bucket location for the CSV files as follows.

Steps to enable CSV Report

  1. Sign into the AWS Management Console.
  2. Then click on My Account/ Console Tab. Select My Account you will get Amazon Web Services Sign in window as follows - You may sign in using your existing Amazon.com account and password. (Put your username and password and click on Sign in using Our Server Security Tab)
  3. You will get Access to your AWS Manage Account.
  4. After login into AWS click on My Account/ Console Tab. And Select Account Activity Tab
  5. In Open Window Select Billing Preferences TAB
  6. In the CSV Report section, click Sign up Now to enable CSV reporting.
  7. In the Programmatic Access section, sign up for Programmatic Billing Access by clicking Sign up Now.
  8. Enter the name of the bucket to contain the CSV file.
  9. Click Sample Policy link to display the policy for your bucket.
  10. AWS provides you with a policy for your bucket and account.
  11. Copy the policy from your Billing Preferences page so you can attach it to the bucket to contain the CSV file in a later step.
  12. Click Save Changes.
  13. Open the Amazon S3 console at https://console.aws.amazon.com/s3.
  14. Attach the sample policy to the bucket that will contain the CSV file.
  15. Verify your bucket is set up correctly on the Billing Preferences page. If correct, you will see Programmatic Access is Enabled.
  16. Set a policy on the bucket granting AWS access to publish your CSV files to the bucket at the specified location. (Note- The CSV files are stored in Amazon S3 at standard Amazon S3 pricing). Following is the screen shot for more info -
  17. Use an application, such as Microsoft Excel, to parse the billing data. Or, use the existing Amazon S3 API to write applications that access your billing data.

Steps to Create Bucket

Before you can upload data into Amazon S3, you must create a bucket to store the data in. Buckets have configuration properties, including their geographical region, which has access to the objects in the bucket, and other metadata, such as the storage class of the objects in the bucket.

Note - You are not charged for creating a bucket; you are only charged for storing objects in the bucket and for transferring objects in and out of the bucket.

To create a bucket -

  1. Sign into the AWS Management Console and open the Amazon S3 console.
  2. Click Create Bucket. The Create a Bucket dialog box appears.

  3. Enter a bucket name in the Bucket Name field.
  4. In the Region drop-down list box, select a region.
  5. Do one of the following.
  6. If you clicked Set Up Logging, the Create a Bucket - Set Up Logging dialog box appears so that you can set up logging:

    • Select the Enabled check box.
    • This choice enables logging.

    • In Target Bucket, select the bucket where you want the log files stored.
    • In Target Prefix, you have the option of specifying a prefix for the name of the log files.

      Amazon S3 adds the prefix to the log file names when storing them in your bucket. For example, if you specify the prefix "logs/," all logs stored in the target bucket are prefixed with logs/, so, all the logs will be stored in the logs folder.

  7. Click Create.
    If Amazon S3 successfully creates your bucket, the console displays your bucket with Created name as follows.

Benefits of Programmatic Billing Access

  1. CSV file - you get a detailed report in a format that is readable by many common applications.
  2. Easy Viewing in Excel - you can open the file directly into Microsoft Excel, and use pivot tables to create different views.
  3. Leverage Amazon S3 API - the CSV file is stored in Amazon S3 as an object.

References:

http://docs.amazonwebservices.com/awsaccountbilling/latest/about/programaccess.html
http://docs.amazonwebservices.com/AmazonS3/latest/UG/EditingBucketPermissions.html