Streamline your billing: Automated cost reports with OCI Functions

June 17, 2024 | 4 minute read
Michael Fung
Master Principal Cloud Solution Architect
Lovelesh Saxena
Engineering Architect
Tim Lee
Cloud Engineer
Text Size 100%:

Tracking cloud spend is crucial for ensuring funds are allocated efficiently to the right resources. Timely delivery of this information to the relevant recipients is therefore vital. Oracle Cloud Infrastructure (OCI) offers various methods for generating cost reports stored in object storage. Our tutorial demonstrates how to automate the dissemination of these reports to your recipients through email notifications. 

This solution has following goals:

  • Optimize the cost of operation by using Object Lifecycle Management
  • Secure reports at rest and transmission
  • Flexible configuration of reports delivery
  • Optimize load and bandwidth resources in report delivery

What the solution uses

We used the following OCI services:

  • Functions is a self-contained piece of code that performs a specific task within the Oracle Cloud Infrastructure (OCI) platform. This serverless compute service allows you run code without having to manage servers.
  • Events lets you automate tasks based on changes happening to your cloud resources.
  • Object Storage is a secure and scalable service for storing any type of data in its native format.
  • Cost Governance helps you control and optimize your cloud spending with tools for budgeting, reporting, and resource management.
  • Logging is a centralized service for managing and analyzing logs from all your OCI resources.
cost report architecture
Cost Report Architecture
Cost Report Workflow
Cost Report Workflow

Functions, PARs,  and OSLM

Cost reports uploaded to Object Storage emits an event that triggers a function call for execution.  Using Functions have the following advantages:

  • Reduced operational overhead: OCI Functions eliminates the need to provision or manage servers. OCI Functions takes care of scaling and patching the underlying infrastructure automatically.
  • Scalability: OCI Functions can automatically scale up or down to meet demand.
  • Cost-effectiveness: You only pay for the resources your functions consume. This can result in significant cost savings compared to traditional server-based deployments.
  • Faster development and deployment: OCI Functions simplifies the development and deployment process. Developers can write code in various languages and deploy it quickly with minimal configuration.
  • Integration with other OCI services: OCI Functions integrates seamlessly with other OCI services, such as Object Storage.

Functions converts selected files to a Pre-Authorized Request (PAR). PARs have the following advantages:

  • Security: With attachments, anyone who intercepts the email could potentially access the report. PARs offer more control. You can set specific read-only permissions and a time limit for accessing the report.
  • Reduced email size: Large reports can bloat email size and lead to delivery issues. PARs point to the report in cloud storage, keeping the email itself lightweight.
  • Version control: If you need to send an updated version of the report, you can simply update the file in cloud storage, and the PAR always links to the latest version. No need to resend the entire report.
  • Revocation: If a PAR accidentally lands in the wrong hands, you can revoke access immediately. You can’t do that with a traditional email attachment.

An email notification is created and sent to recipients with the costing reports contain in a PAR URL. Recipients of the email simply download the costing reports by clicking on each PAR URL. Use Object Storage Lifecycle Management (OSLM) to move old reports from standard storage tier to archival tier for costs savings. OSLM has the following advantages:

  • Cost optimization: One of the key benefits of OSLM is cost optimization. You can define rules to automatically transition less frequently accessed data to a lower cost storage tier, like Archive Storage. Archive Storage can be significantly cheaper than standard Object Storage.
  • Automated data management: OSLM automates the process of managing your object data over time. You can define rules for archiving or deleting objects based on criteria like age, access frequency, or specific tags. This feature saves you time and effort compared to manually managing your data lifecycle.
  • Improved data governance: OSLM helps you comply with data governance policies. You can set rules to automatically delete objects that have reached the end of their retention period. This feature ensures that sensitive data isn’t stored for longer than necessary.
  • Reduced storage footprint: By archiving or deleting less frequently accessed data, OSLM helps you reduce your overall storage footprint, which can benefit organizations with large amounts of data.
  • Simplified compliance: OSLM can simplify compliance with regulations that require data to be retained for a specific period and then deleted.
  • Scalability: OSLM scales automatically with your data. You don’t need to worry about manually managing storage tiers as your data volume grows.

For full details on how to set up this solution, read the full tutorial, Set Up Events Based Automated Email Notifications for Cost Analysis Reports Using Oracle Cloud Native Framework.

Conclusion

By using Object Storage and programmatic notifications, you can establish a robust and automated system for delivering cost reports in OCI. This streamlined approach ensures timely delivery of crucial financial information to key stakeholders, empowering informed decision-making around cloud resource allocation and cost optimization. By implementing the automation techniques outlined in this guide, you can gain valuable control over your OCI spend and ensure your cloud resources are utilized effectively.

Michael Fung

Master Principal Cloud Solution Architect

As a Cloud Solution Architect, it is my job to offer a full spectrum of cloud services to help you realize the value of your business investments.  After working many years as a solution architect, I understand that cloud is more than just technology, it is also critical to place importance on the workforce and culture change that can bridge the gap between current needs and future goals.  With experiences in Oracle Cloud Infrastructure and Microsoft Azure, my focus is also to empower your business to leverage Multi-cloud and Inter-cloud to future proof your cloud investments.

Lovelesh Saxena

Engineering Architect

Tim Lee

Cloud Engineer


Previous Post

Improving deliverability with OCI Email Delivery one-click unsubscribe

Allan Yeung | 3 min read

Next Post


Transitioning from Terraform to Pulumi: Implementing multiple IaC tools in the cloud

Akarsha Itigi | 4 min read