{ "info": { "author": "Mitch Garnaat", "author_email": "mitch@scopely.com", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/scopely-devops/details.svg?branch=master)](https://travis-ci.org/scopely-devops/details)\n\ndetails\n=======\n\nUtilities to process AWS detailed billing reports.\n\nInstallation\n------------\n\nThe easiest way to install ``details`` is by using ``pip``:\n\n $ pip install details\n\n\nBackgroud\n---------\n\nThe ``details`` package parses the detailed billing reports produced by\nAWS. You can find out more about these reports and how to enable them\nfor your AWS accounts [here](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html). All testing thus far has been\ndone using the **Detailed billing report with resources and tags** but the\ncode should work with any detailed billing report.\n\nOnce you have enabled detailed billing on your accounts, AWS will begin to\nsave these CSV reports in the S3 bucket you have configured. The ``details``\nlibrary assumes you have copied the reports from S3 to your local file\nsystem and uncompressed them if necessary. The [AWS CLI](https://aws.amazon.com/cli) is a good way to copy the files from S3.\n\nThe detailed billing files contain a row (a line item) for every charge on an\naccount with hourly granularity. These files can get **huge**. These tools\ncurrently load an entire months worth of data into memory so if you have a\nreally large bill this could become impractical. However, it has been\ndemonstrated to work reasonably well on detailed billing reports containing\nmillions of line item records.\n\nUsage\n-----\n\nOnce you have a detailed billing CSV file available locally, you can load\nthe file into ``details`` like this:\n\n >>> import details\n >>> total = details.load('../../bills/123456789012-aws-billing-detailed...')\n\nThe variable ``costs`` now points to a ``Cost`` object which contains all of\nthe line item data for the entire billing file. Note that depending on the\nsize of your detailed billing report, this operation can take some time.\n\nNow that you have the ``Cost`` object, you can start by asking it for \nthe total cost of the detailed billing report:\n\n >>> total.cost\n Decimal('1035.7549984289')\n >>>\n\nThis number should match (or very nearly match, there are some rounding\nerrors at times) the total on your bill. The other thing to note is that\nthe value returned is a Python Decimal number. The Decimal type is used\nto avoid any further rounding errors within the ``details`` package.\nYou can use these Decimal numbers as you would normal ints or floats.\nCheckout [this](https://docs.python.org/2/library/decimal.html)\nfor more details on the Decimal type.\n\nIn addition to telling you the total cost, the ``Cost`` object has\na few other useful methods.\n\nTo find all of the *columns* in CSV data:\n\n >>> total.columns\n ['InvoiceID',\n 'PayerAccountId',\n 'LinkedAccountId',\n 'RecordType',\n 'RecordId',\n 'ProductName',\n 'RateId',\n 'SubscriptionId',\n 'PricingPlanId',\n 'UsageType',\n 'Operation',\n 'AvailabilityZone',\n 'ReservedInstance',\n 'ItemDescription',\n 'UsageStartDate',\n 'UsageEndDate',\n 'UsageQuantity',\n 'BlendedRate',\n 'BlendedCost',\n 'UnBlendedRate',\n 'UnBlendedCost',\n 'ResourceId',\n 'user:Name',\n 'user:Role']\n\nTo find all possible values found within a particular column:\n\n >>> total.values('ProductName')\n ['Amazon Simple Storage Service',\n 'Amazon DynamoDB',\n 'Amazon Route 53',\n 'Route 53 Domain Registration Service',\n 'AWS Data Pipeline',\n 'Amazon Elastic MapReduce',\n 'Amazon RDS Service',\n 'Amazon Zocalo',\n 'Amazon Simple Queue Service',\n 'AWS Support (Business)',\n 'Amazon Simple Notification Service',\n 'Amazon CloudFront',\n 'AWS Support (Developer)',\n 'Amazon WorkSpaces',\n 'Amazon Redshift',\n 'Amazon Elastic Compute Cloud',\n 'Amazon ElastiCache',\n 'Amazon Kinesis',\n 'Amazon CloudSearch',\n 'Amazon SimpleDB',\n 'Amazon Simple Email Service']\n\nThis list will include only the services that actually were used within\nthis account.\n\nIf this report was for a consolidated account, you could find all of the\naccounts contained within this report like this:\n\n >>> total.values('LinkedAccountId')\n ['012345678901',\n '123456789012']\n >>>\n\nThe above total represents all of the costs for all services within this\naccount. What if you wanted to find the costs just for the EC2 service?\nTo do this, use the ``filter`` method. It takes a list of filters where\neach filter consists of a column name and a regular expression. Each value in\nthat column name is compared to the regular expression and if it matches\nit is collected and returned with all of the other matches in another\n``Costs`` object.\n\n >>> ec2 = total.filter([('ProductName', '.*Compute Cloud.*')])\n >>> ec2.cost\n Decimal('315.88505363')\n >>>\n\nSo the total cost for EC2 in this account was $315.89. However, if you\ncompare that to your bill you will probably find that it doesn't match.\nThe reason (probably) is that this number includes all Data Transfer\ncharges incurred as part of the EC2 usage but your monthly bill breaks\ndata transfer out as a separate line item. To break out the data transfer\ncosts:\n\n >>> data_transfer = ec2.filter([('UsageType', '.*DataTransfer.*')])\n >>> data_transfer.cost\n Decimal('35.45916220')\n >>>\n\nSo, if you subtract the data transfer costs from the EC2 costs you should\nsee the number on your bill.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scopely-devops/details", "keywords": null, "license": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright {yyyy} {name of copyright owner}\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.", "maintainer": null, "maintainer_email": null, "name": "details", "package_url": "https://pypi.org/project/details/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/details/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/scopely-devops/details" }, "release_url": "https://pypi.org/project/details/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Tools for processing AWS detailed billing reports", "version": "0.2.0" }, "last_serial": 1269525, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "eff182115c3f8c5ec15f89ce1fffb3c7", "sha256": "958c11b3143c69ceb2d170a9c0a293e0889c39c4a60e24870ff48dc8f0d198db" }, "downloads": -1, "filename": "details-0.1.0.tar.gz", "has_sig": false, "md5_digest": "eff182115c3f8c5ec15f89ce1fffb3c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8793, "upload_time": "2014-10-13T22:00:40", "url": "https://files.pythonhosted.org/packages/d4/6a/b8c9b3f3c1c34f51ccc26e672bcbca36522d0c9da4195cece228987600a0/details-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "03832bf2ca3b15ab577ef653029e69fc", "sha256": "c767226f01c65a752e5bf750200f6101fff7b25a128d686b6af58f694d7a7aa4" }, "downloads": -1, "filename": "details-0.2.0.tar.gz", "has_sig": false, "md5_digest": "03832bf2ca3b15ab577ef653029e69fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11810, "upload_time": "2014-10-14T03:34:27", "url": "https://files.pythonhosted.org/packages/6c/38/7d3efb9e661add4f31f938807ee24746f0948c5aa25a59a29a81d2b75bbf/details-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "03832bf2ca3b15ab577ef653029e69fc", "sha256": "c767226f01c65a752e5bf750200f6101fff7b25a128d686b6af58f694d7a7aa4" }, "downloads": -1, "filename": "details-0.2.0.tar.gz", "has_sig": false, "md5_digest": "03832bf2ca3b15ab577ef653029e69fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11810, "upload_time": "2014-10-14T03:34:27", "url": "https://files.pythonhosted.org/packages/6c/38/7d3efb9e661add4f31f938807ee24746f0948c5aa25a59a29a81d2b75bbf/details-0.2.0.tar.gz" } ] }