Implementing CUDOS Cost Intelligence Dashboards for an Enterprise
Tags: finops, cloudcostmanagement
Published: 2022-04-29 22:29:06

## Part 1 - Deployment and SSO Integration

<!-- wp:paragraph -->
<p>At my day job I recently led a project to move away from CloudHealth for cost reporting and implement some new tools to replace the functionality of CloudHealth.  CloudHealth is a great tool but my company no longer wanted to pay a percentage of our spend just to get the reporting capabilities, especially as our spend continues to grow.  While I found that native tools like <a rel="noreferrer noopener" href="https://aws.amazon.com/aws-cost-management/aws-cost-explorer/" target="_blank">AWS Cost Explorer</a> and <a rel="noreferrer noopener" href="https://aws.amazon.com/aws-cost-management/aws-cost-categories/" target="_blank">Cost Categories</a> met a lot of our requirements, I wanted some additional analytics tools that allowed us to see billing data across multiple AWS accounts in a single dashboard, as well as provide a means to restrict users to only be able to see certain AWS account</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To solve this requirement, my AWS Technical Account Manager let me know about a set of open source QuickSight Cost Intelligence dashboards developed by AWS.   The suite includes the CUDOS Dashboard, Cost Intelligence Dashboard, Trusted Advisor Dashboard, and Trends dashboard and are all built using a combination of AWS services including the Cost and Usage Report, S3, Glue, Athena and QuickSight.  You can read up more on these offerings and the underlying architecture in this <a href="https://aws.amazon.com/blogs/mt/visualize-and-gain-insights-into-your-aws-cost-and-usage-with-cloud-intelligence-dashboards-using-amazon-quicksight/">AWS blog post</a>. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>This article is not going to be a walkthrough on how to setup these dashboards from scratch. There is already an excellent guide on this in the form of a series of <a rel="noreferrer noopener" href="https://wellarchitectedlabs.com/cost/200_labs/200_cloud_intelligence/" target="_blank">AWS Well Architected Labs</a> that guide you through the whole process.  You can also use <a href="https://d1s0yx3p3y3rah.cloudfront.net/anonymous-embed?dashboard=cudos" target="_blank" rel="noreferrer noopener">this demo site from AWS</a> to get hands on with the dashboards to check out their capabilities.  I suggest you go through these labs to get the dashboards setup and then come back here and read my posts for a series of tips for how to implement this solution for a large enterprise supporting multiple different cloud teams.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For this series of articles I'm going to be primarily focusing on the CUDOS dashboard which looks like this:</p>
<!-- /wp:paragraph -->


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j06ja1ke6pmhibt8h99.png)

<!-- wp:paragraph -->
<p>Part 1 of this series will be on Implementing AWS SSO for QuickSight.  Future posts will cover topics like customizing and publishing dashboards to users, as well as how to implement row level security in QuickSight to filter access for different account owners.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Implementing AWS SSO for QuickSight</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To make things simple, I deployed my QuickSight dashboards in my AWS organization payer account aka the management account.  However I don't want to allow everyone who needs access to these dashboards to login to the AWS Console on my management account.   Instead, I wanted them to login to QuickSight directly via SSO.   In my environment I already have AWS SSO implemented to allow users to access the AWS Console using their corporate credentials, so I was able to extend that capability to provide a login for QuickSight.  If you need guidance on setting up AWS SSO for the first time, I refer you to AWS' <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/getting-started.html" target="_blank" rel="noreferrer noopener">documentation on the subject</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>AWS also provides pretty good documentation on how to implement various IdPs with Amazon QuickSight, but in this post I've distilled down a step-by-step guide for implementing AWS Single Sign-On as your IdP for QuickSight (assumes you already have AWS Single Sign-On implemented for AWS Console logins).  To complete the setup, there are four tasks we much complete:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><a href="#CreateNewApp">Configure a new Application in the IdP (AWS SSO)</a></li><li><a href="#CreateNewIDP">Create new SAML IdP in AWS IAM and configure it for QuickSight</a></li><li><a href="#AttributeMapping">Update attribute mappings in AWS SSO</a></li><li><a href="#AssignUsers">Assign users to your new Application in AWS SSO</a></li></ol>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h3 id="CreateNewApp">Create new Application in AWS Single Sign-On</h3>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:list {"ordered":true} -->
<ol><li>Login to your AWS Organization Management account, navigate to the AWS Single Sign-on service</li><li>On the left hand bar, click on <strong>Applications</strong>.</li><li>On the Applications screen, click the blue <strong>Add a new application</strong> button</li></ol>
<!-- /wp:list -->

<p>4. In the search box, type "<strong>QuickSight</strong>"</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>5. When Amazon QuickSight is displayed, click on it to select it and then click the blue <strong>Add Application</strong> button at the bottom of the screen</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:media-text -->

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wqjg7wnyqdfe0544kl2m.png)

<!-- wp:paragraph -->
<p>6. The next screen will allow you to enter configuration details for your application.  Click on the <strong>View instructions</strong> link to get the specific configuration instructions for Amazon QuickSight, which I will walk you through below </p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wltf2v3ievgsygh22fz.png)

<p>7.  Under Details, enter a display name and description for your app. You can accept the defaults if you wish.</p>
<!-- /wp:paragraph -->

<p>8. In the <strong>AWS SSO metadata</strong> section, click the link to download the AWS SSO Metadata file to your computer.  We will use this file later when we complete the IAM configuration.</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/az5hh6bflf5zxdqrs5fz.png)

<p>9. Under <strong>Application properties</strong>, ensure Relay State has the value `https://quicksight.aws.amazon.com` and set the Session duration to whatever value you prefer...I recommend keeping it to 4 hours or less.</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pyiou04vp7oevlz2lzl.png)

<p>10. Under <strong>Application metadata</strong>, ensure that the Application ACS URL is set to `https://signin.aws.amazon.com/saml` and the SAML audience should be set to `urn:amazon:webservices`</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6pv2if69ry7tvod2godw.png)

<p>Click <strong>Save Changes</strong> to save your SAML configuration.   Now we are ready to move on to IAM configuration</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="CreateNewIDP">Create new IAM SAML Identity Provider</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>First we need to create a new Identity Provider in IAM for the Application we just created.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol id="block-df7dc35d-228e-45aa-a2aa-1ef9ad72de44"><li>If you are not already signed in, sign in to the AWS Management Console in your Management account</li><li>Navigate to the IAM service</li><li>On the left hand navigation bar, click <strong>Identity Providers</strong></li><li>Click the blue button <strong>Add Provider</strong> on the upper right </li><li>On the resulting screen, leave the provider type as <strong>SAML</strong></li><li>Enter a unique provider name</li><li>Click the<strong> Choose file</strong> button and upload the metadata file you downloaded in the earlier section</li><li>Add tags as appropriate and click the blue <strong>Add Provider </strong>button</li></ol>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4oju4g6nieyyrrw2dlnz.png)

<!-- wp:paragraph -->
<p>Next, we need to implement a SAML Federation IAM role.  The purpose of this role is to establish a trust relationship between IAM and AWS SSO.  To implement, navigate to the <strong>Roles</strong> section of IAM and click <strong>Create Role</strong>.  I will walk you through each step of the Create Role wizard.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Step 1 - Select Trusted Entity</h4>
<!-- /wp:heading -->

<!-- wp:list {"ordered":true} -->
<ol><li>Click the Radio button next to "SAML 2.0 federation"</li><li>From the SAML 2.0 Provider drop down, select the IDP you just created</li><li>Select the radio button for "Allow programmatic and AWS Management Console access"</li><li>Click the blue <strong>Next</strong> button</li></ol>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzmre7bro864cfdh0a6u.png)


<!-- wp:heading {"level":4} -->
<h4>Step 2 - Add permissions</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Now we need to attach a policy to this new role.  We will be building a custom policy so click the <strong>Create Policy</strong> button on the upper right.  A new window will pop open for you to create a policy, click the JSON tab and enter a policy in JSON format using the following as a guide, replacing the account ID with your own:</p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre class="wp-block-preformatted">{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "quicksight:CreateReader"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:quicksight::<em>accountid</em>:user/${aws:userid}"
        }
    ]
}</pre>
<!-- /wp:preformatted -->

<!-- wp:paragraph -->
<p>Note that for my purposes, I only want SSO users to have the QuickSightReader permission, so my policy only includes that permission.   This <a href="https://docs.aws.amazon.com/quicksight/latest/user/external-identity-providers-setting-up-saml.html#external-identity-providers-grantperms" target="_blank" rel="noreferrer noopener">QuickSight documentation page</a> provides details on additional permissions you can grant if desired.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Give your policy a name and then click the blue <strong>Create Policy</strong> button.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Go back to the window where you were creating the new Role, click refresh on the policy screen, and then select the new policy you just created and click <strong>Next</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Step 3 - Name, review and create</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Give your role a name, a description and validate the trust and permissions are correct.  Add tags as needed and then click the blue <strong>Create role</strong> button.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="AttributeMapping">Update Attribute Mapping in AWS SSO</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>With our IDP and IAM role created, we need to go back to AWS Single Sign On and update our QuickSight application with the proper attribute mappings to use the IAM role and IDP.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>While signed in to the AWS Management Console in the Organizations Management account, navigate back to the AWS Single Sign-On (SSO) service</li><li>On the left hand menu, select <strong>Applications</strong></li><li>Click on the Amazon QuickSight application you previously created</li><li>Choose the <strong>Attribute Mappings</strong> tab</li><li>Click <strong>Add new attribute mapping</strong></li><li>In the first field, enter `https://aws.amazon.com/SAML/Attributes/Role`</li><li>In the Value field, enter <strong>both</strong> the ARNs for the IAM role and the SAML provider <strong>separated with a comma</strong>, e.g. `arn:aws:iam::<strong>ACCOUNTID</strong>:role/<strong>ROLENAME</strong>,arn:aws:iam::<strong>ACCOUNTID</strong>:saml-provider/<strong>SAMLPROVIDERNAME`</strong></li><li>Leave Format as unspecified</li><li>Click the blue <strong>Save Changes</strong> button</li></ol>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h3 id="AssignUsers">Assign Users to Application</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>With all the back-end setup work completed, we can now assign users to our QuickSight application!</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>While signed in to the AWS Management Console in the Organizations Management account, navigate back to the AWS Single Sign-On (SSO) service</li><li>On the left hand menu, select <strong>Applications</strong></li><li>Click on the Amazon QuickSight application you previously created</li><li>Choose the <strong>Assigned Users</strong> tab</li><li>Click the blue <strong>Assign users</strong> button</li><li>In the assign Users screen you can toggle between Users and Groups, select the User or Group you wish to assign to the Application and then click the blue <strong>Assign users</strong> button </li></ol>
<!-- /wp:list -->

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eixngswztemm8xs3nhqu.png)

<!-- wp:paragraph -->
<p>NOTE: I'd recommend you create a new AWS SSO group for this purpose and assign the application to the group.  That way when you onboard more users you can just add them to the group.   </p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Test!</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>With all the configuration out of the way, you can now test the SSO configuration.  Login to your AWS SSO portal using the user you assigned to the QuickSight Application.   In addition to the AWS Account application they should now see an application button for Amazon QuickSight.</p>
<!-- /wp:paragraph -->


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pvw2ynvrzbqiyhsaei1y.png)

<!-- wp:paragraph -->
<p>Clicking on the Amazon QuickSight button will launch QuickSight in a new window and the user will be walked through the first time login screen.  Note when they initially login they will not have any dashboards visible until an admin assigns them.  I will cover this topic in my next post in this series so stay tuned!</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this article I gave you a quick introduction to the QuickSight Cost Intelligence dashboards, and walked you through how you can connect AWS Single Sign-on to QuickSight so that users can use their corporate credentials to access QuickSight directly.  In future articles in this series I will be covering customizing and publishing dashboards to users, as well as how to implement QuickSight Groups and use row level security in QuickSight to filter access for different account owners.  I hope you found this information useful, and please feel free to send me feedback or ask questions in the comments below.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Finally, I have to give a huge thanks to Jenny Oshima, my AWS Technical Account Manager, as well as Aaron Edell, GTM for Customer Cloud Intelligence for AWS who helped me out a ton during the implementation phase of this project.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>References:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://aws.amazon.com/blogs/mt/visualize-and-gain-insights-into-your-aws-cost-and-usage-with-cloud-intelligence-dashboards-using-amazon-quicksight/" target="_blank" rel="noreferrer noopener">AWS Blog - Visualize and gain insights into your AWS cost and usage with Cloud Intelligence Dashboards and CUDOS using Amazon QuickSight</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a rel="noreferrer noopener" href="https://aws.amazon.com/blogs/aws-cloud-financial-management/a-detailed-overview-of-the-cost-intelligence-dashboard/" target="_blank">AWS Blog - A Detailed Overview of the Cost Intelligence Dashboard</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://wellarchitectedlabs.com/cost/200_labs/200_cloud_intelligence/" target="_blank" rel="noreferrer noopener">Well Architected Labs - Cloud Intelligence Dashboards</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://github.com/aws-samples/aws-cudos-framework-deployment" target="_blank" rel="noreferrer noopener">Github - CUDOS Deployment Framework</a></p>
<!-- /wp:paragraph -->