Lab complete!
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool
The FAQ for this dashboard is here.
Ensure you have requested access to the Cost Intelligence template here.
This section is optional and automates the creation of the Cost Intelligence Dashboard using a CloudFormation template. The CloudFormation template allows you to complete the lab in less than half the time as the standard setup. You will require permissions to modify CloudFormation templates, create an IAM role, create an S3 Bucket, and create an Athena Database. If you do not have the required permissions skip over this section to continue using the standard setup.
To create the dashboard using the standard setup move to the Create Athena Views section
The data source for the dashboard will be an Athena view of your existing Cost and Usage Report (CUR). The default dashboard assumes you have both Savings Plans and Reserved Instances, if not you will need to create the alternate views.
Login via SSO in your Cost Optimization account, go into the Athena console:
Modify and run the following queries to confirm if you have Savings Plans, and Reserved Instances in your usage. If no lines are returned, you have no Savings Plans or Reserved Instances. Replace (database).(tablename) and run the following:
Savings Plans:
select * from (database).(tablename)
where savings_plan_savings_plan_a_r_n not like ''
limit 10
Reserved Instances:
select * from (database).(tablename)
where reservation_reservation_a_r_n not like ''
limit 10
Create the Summary view by modifying the following code, and executing it in Athena:
Create the EC2_Running_Cost view by modifying the following code, and executing it in Athena:
Create the Compute savings plan eligible spend view by modifying the following code, and executing it in Athena:
Create the s3 view by modifying the following code, and executing it in Athena:
Create the RI SP Mapping view by modifying the following code, and executing it in Athena:
The Athena Views are updated to reflect any additions in the cost and usage report. If you created your dashboard prior to October 26, 2020 you will want to update to the latest views.
We will now create the data sets in QuickSight from the Athena views.
Go to the QuickSight service homepage
Click Manage data:
Click New dataset
Click Athena
Enter a data source name of Cost_Dashboard and click Create data source:
Select the costmaster database, and the summary_view table, click Edit/Preview data:
Select SPICE to change your Query mode:
Hover over payer_account_id to get the drop down arrow and click on it the then hover over Change data type then select # Int:
Repeat step 8 for linked_account_id to change it to Int
Select Save:
Select the summary_view Data Set:
Click Schedule refresh:
Click Create:
Enter a schedule, it needs to be refreshed daily, and click Create:
Click Cancel to exit:
Click the x in the top corner:
Repeat steps 3-16, creating data sets with the remaining Athena views. The data source name will be Cost_Dashboard, and select the following views as the table:
Select summary_view Data Set:
Select Edit data set
Select Add Data:
Select your ri_sp_mapping view and click Select:
Select the two circles to open the Join configuration then select Left to change your join type:
Select Add a new join clause two times so you have 3 join clauses:
Create following 3 join clauses then click Apply:
Change the payer_account_id_mapping field to Int:
Select Save
You now have your data set setup ready to create a visualization.
We will now use the CLI to create the dashboard from the Cost Intelligence Dashboard template, then create an Analysis you can customize and modify in the next step.
Go to this page to request access to the template. Enter your AWS AccountID and click Submit: Template Access
Edit the following command, replacing AccountID and region, then using the CLI list the QuickSight datasets and copy the Name and Arn for the 4 datasets: s3_view, ec2_running_cost, compute_savings_plan_eligible_spend, summary_view:
aws quicksight list-data-sets --aws-account-id (AccountID) --region (region)
Get your users Arn by editing the following command, replacing AccountID and region, then using the CLI run the command:
aws quicksight list-users --aws-account-id (AccountID) --namespace default --region (region)
Create a local file create-dashboard.json with the text below, replace the values (Account ID) on line 2, (User ARN) one line 7, and each Dataset (ARN) on lines 25, 30, 35, 40:
{
"AwsAccountId": "(Account ID)",
"DashboardId": "cost_intelligence_dashboard",
"Name": "Cost Intelligence Dashboard",
"Permissions": [
{
"Principal": "(User ARN)",
"Actions": [
"quicksight:DescribeDashboard",
"quicksight:ListDashboardVersions",
"quicksight:UpdateDashboardPermissions",
"quicksight:QueryDashboard",
"quicksight:UpdateDashboard",
"quicksight:DeleteDashboard",
"quicksight:DescribeDashboardPermissions",
"quicksight:UpdateDashboardPublishedVersion"
]
}
],
"SourceEntity": {
"SourceTemplate": {
"DataSetReferences": [
{
"DataSetPlaceholder": "summary_view",
"DataSetArn": "(Summary Dataset ARN)"
},
{
"DataSetPlaceholder": "ec2_running_cost",
"DataSetArn": "(ec2_running_cost Dataset ARN)"
},
{
"DataSetPlaceholder": "compute_savings_plan_eligible_spend",
"DataSetArn": "(compute_savings_plan_eligible_spend Dataset ARN)"
},
{
"DataSetPlaceholder": "s3_view",
"DataSetArn": "(s3_view Dataset ARN)"
}
],
"Arn": "arn:aws:quicksight:us-east-1:869004330191:template/optics_cost_analysis"
}
},
"VersionDescription": "1"
}
To create the dashboard from the template, edit then run the following command, replacing (region) and you should receive a 202 response:
aws quicksight create-dashboard --cli-input-json file://create-dashboard.json --region (region)
After a few minutes the dashboard will become available in QuickSight under All dashboard, click on the Dashboard name:
Click Share, click Share dashboard:,
Click Manage dashboard access:
Add the required users, or share with all users, ensure you check Save as for each user, then click the x to close the window:
Click Save as:
Enter an Analysis name and click Create:
Perform steps 11 and 12 above to create additional analyses for other teams, this will allow each team to have their own customizable analysis.
You have successfully created the analysis from a template. For a detailed description of the dashboard read the FAQ
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool