September 24, 2020

Getting Started with Cloud Cost Optimization

Table of Contents

Key takeaway

With the introduction of Cloud Cost Management and now the Cloud Cost Management trial, everyone has access to cloud cost optimization. If you are curious about how to get started and even if you are new to the Harness Platform, we have you covered. 

In this example, I am tackling AWS Cost Optimization in my cloud budget. I am leveraging Amazon Elastic Kubernetes Service and have access to my billing module inside of AWS. Whether you're familiar with Kubernetes or looking for a Kubernetes tutorial, let’s get started and get Cloud Cost Management wired in. Like always, you can follow along with the blog and/or watch the video.

Getting Started - Sign up for Harness

If you have not yet, sign up for a Harness Account. For this example, we will be leveraging the free Community Edition of the Harness CD Platform. 

Once you logged into your account, you are greeted with the Harness Dashboard. 

The first thing to do with leveraging Harness is to install a Harness Delegate, which is a worker node performing actions on your behalf. 

Switching gears quickly, I do have an awaiting Amazon EKS Cluster. So the Harness Delegate that would be prudent would be a Kubernetes Delegate.  

Back in the Harness Platform installing a Delegate is simple. 

Setup -> Harness Delegates -> Install Delegate. Select Kubernetes YAML and give a name like “keep-costs-low”. 

Once the TAR has downloaded, expand the TAR and then enter into the expanded folder. 

Inside the Delegate folder, there is a readme with the KubeCTL instructions. Running

kubectl apply -f harness-delegate.yaml will install the Harness Delegate. 

In a few moments, can validate on the Delegate UI that the Harness Delegate has wired up.

With the Harness Delegate out of the way, let’s prep the EKS cluster to start being observed by Cloud Cost Management.   

Kubernetes Cluster Prep

Cloud Cost Management uses Kubernetes Metric Server as a datapoint. Depending on your Kubernetes provider, this might or might not be installed for you when you instantiate a cluster. In the case of EKS, this is not there by default. 

You can install the Kubernetes Metric Server by running “kubectl apply -f”.

Can run a quick test of if the Kubernetes Metric Server is running by running “kubectl top nodes”.

With your Kubernetes/EKS cluster prepped, time to activate your Cloud Cost Management trial. 

Activate Your Cloud Cost Management Trial

Activating a Cloud Cost Management trial is straightforward.  Navigate in the left navigation pane. Click on “Continuous Efficiency” and can sign up for a Cloud Cost Management trial inside the platform. 

Once you hit Start Free Trial, can start to wiring in configurations. If you need to come back to the setup, can navigate back to Continuous Efficiency -> Settings. 

With the Kubernetes Delegate running wiring in the EKS cluster is a breeze. Select Kubernetes Cluster from the Cloud Cost Management Settings menu. 

Add the Kubernetes Cluster to the Harness Platform in two steps. First name the Kubernetes Cluster something like “Big Money Cluster”, click Test then Next. 

Once you hit Next, on the Continuous Efficiency enablement menu, check Enable Continuous Efficiency. 

Click Submit and you are configured to monitor for Kubernetes usage. 

Cloud Cost Management does take 2-3 hours to complete its initial assessment. You will get an email when the cloud spend data is available. 

If there are existing workloads, usage data will start to be reported also. Though if this is your first time interacting with the Kubernetes Cluster or your first time going through the example, you can easily seed some workloads with Harness CD. 

Seeding Kubernetes Workloads

If your Kubernetes Cluster is empty like mine in the example, leveraging Harness CD to deploy a sample workload is a great next step.  Harness works on a CD Abstraction Model with the basis of that model as a Harness Application.

Add a Harness Application by going to: 

Setup -> Applications + Add Application

Can add an Application with a name of “Not Expensive App”.

Once you click Submit, can start filling out the pieces of the abstraction model. 

The first piece to set up an Harness Environment to deploy to. 

Setup -> Not Expensive App -> Environments + Add Environment. Create a Non-Production environment called “Sandbox”.

We can let Harness know as part of the “Sandbox” environment is our Kubernetes Cluster we just wired in with an Infrastructure Definition.

Click on + Add Infrastructure Definition. Can name the Definition “K8s Cluster” as a Kubernetes Cluster Type and will be a Kubernetes Deployment. 

Click Submit and now it’s time to define what you are actually deploying by creating a Harness Service

Setup -> Not Expensive App -> Services + Add Service

Once clicking on Add Service, can add a Kubernetes Service named “Nginx”.

Once in the Service, can wire an artifact source for Nginx which will be public Docker Hub with + Add Artifact Source. Harness comes pre-wired with public Docker Hub as a source. 

Wire in “library/nginx” as the Artifact Source and hit Submit. 

Once you hit Submit, your image is wired to Harness with default scaffolding which is more than sufficient for this example. 

Before you deploy, will need to create a Harness Workflow to instruct Harness on what to do with your application. 

Setup -> Not Expensive App -> Workflows + Add Workflows

Add a Workflow named “Deploy Nginx” as a Rolling Deployment. Select the Environment, Service, and Infrastructure Definition created before. 

Once you click Submit, you are ready to deploy. 

Click Deploy. Select a Tag such as “latest” and hit Submit. 

In a few moments, your fearless Nginx will be deployed to your K8s cluster!

With your first deployment out of the way, you can also sit back and wait for the initial 2-3 hour seeding period.

Understanding Your First Cluster Cost Breakdown

Once you get the email that your data is ready, time to navigate back to Cloud Cost Management. 

Head back to the Harness Platform and then on the left navigation head to Cloud Cost Management. The Budget and Explorer links will be active. Can click on Explorer to visualize your first set of Kubernetes Cluster spend. 

Taking a closer look at how efficient the “big-money-cluster” is, we can see the breakdown in how Cloud Cost Management breaks down Kubernetes container usage

Overall there are certainly ways to tune this cluster. For our example workloads and Harness Delegate, we are way over-provisioned and if this was a cluster that would be long-running, we could re-size the Kubernetes Cluster and re-deploy the workload(s). For myself, I do have several other services that I maintain for the team on AWS, we can also wire Cloud Cost Management to AWS itself. 

Get More Dollar and Cents - Cloud Provider Wiring 

My Kubernetes Workload cost is just part of the picture that Cloud Cost Management can provide. You can garner additional insights into wiring a cloud provider billing (such as Google Cloud billing or AWS) API into Cloud Cost Management.  This will really help with cloud cost optimization.

Your AWS Account does need to be part of an Organization. Can validate in the AWS Organization Console.

Looking at the documentation and/or navigating to Continuous Efficiency -> Settings -> Connect to Your AWS Account, there are a few steps involved in exporting usage data from AWS. The Cloud Cost Management wizard will guide you along. 

The first step is to create a Cost and Usage Report [CUR] in your AWS Account. Can launch the AWS Console or leverage the button from Cloud Cost Management. 

In the AWS Console, click Create Report.

Can give a name of the CUR report, for example, “my-cur-report”. Make sure to select Include resource IDs and Automatically refresh. 

After hitting next, create a S3 Bucket to store the CUR report. 

Can give a name of the new bucket. Though S3 buckets have to be unique across the availability zone, my bucket name “bigmoney-cur-bucket” would not be unique since I am leveraging. 

Once you hit next, the default policy is ok. Back on the Delivery options menu, change the Report path prefix to something e.g “ce”,  Time granularity to hourly, Report versioning to overwrite existing reports, and GZIP for compression. 

Click through Review and Complete. Once that is set up, your first CUR will be delivered by AWS within 24 hours. 

In the meantime, can wire the new report and bucket into the Cloud Cost Management setup. 

The next step would be to grant Cloud Cost Management access to the CUR report to analyze the contents. This will be done with an Identity and Access Management [IAM] role. 

By clicking on the Launch Template button, you will be brought to the AWS Cloud Formation Template Creation wizard e.g Quick create stack.

The default values are fine.  Acknowledge and Create stack. 

The Cloud Formation stack will be created. In the Outputs section of the stack, copy the CrossAccountRoleARN value. 

The ARN value and your account name will be the last two wirings you need to wire into the Cloud Cost Management AWS Setup wizard. 

When complete, you should have CUR and IAM details wired in.  

Click Save & Continue and exit out of the confirmation prompt and you are now all set. 

The analysis process of your cloud spend does take 24 hours by Cloud Cost Management. You are now well on your way to saving money! 

The Harness Platform - Supercharging your Experience with Cloud Cost Management

Cloud Cost Management is a pillar in the Harness Platform. The genesis of Cloud Cost Management was enabling and addressing our own FinOps challenges. Getting the reins on cloud costs is challenging for organizations of all sizes as reported in our 2020 Report on SaaS Cloud Spend. With Cloud Cost Management and the new ability to take a trial, the proof is really in the pudding. Be sure to sign up and start saving on cloud costs, today! 

Do you want to learn more about what other tools there are out there? We mapped out the top cloud cost management tools to consider.

You might also like
No items found.

Similar Blogs

No items found.
Cloud Cost Management