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
By now you have queried AWS Cost & Usage reports with Amazon Athena. You drew proxy metrics for sustainability from AWS usage data. Calculating key performance indicators (KPIs), you might want to extend the queries with further assumptions/ data to reinforce sustainable best practices.
Some examples for further assumptions:
In this lab you will learn to make that data available to your queries as a simple view in Amazon Athena.
aws_usage_queries_database
, which you have deployed in lab 1.4
.us-east-1
, ap-southeast-2
, and eu-west-1
.SELECT DISTINCT(region) FROM monthly_vcpu_hours_by_account
SELECT 'eu-west-1' region, 1 points
UNION SELECT 'eu-central-1' region, 1 points
UNION SELECT 'ca-central-1' region, 1 points
UNION SELECT 'us-gov-west-1' region, 1 points
UNION SELECT 'us-west-2' region, 1 points
UNION SELECT 'ap-southeast-2' region, 2 points
UNION SELECT 'us-east-1' region, 2 points
[add further regions returned in your previous query with 2 points here]
region_points
as Name.Now you can do the same with the instance families to prefer the Graviton2 processor, the ARM-based AWS-designed chip. This is currently the most power efficient processor AWS offers to customers as Graviton 2 processors provide better performance per watt than any other EC2 processor.
SELECT DISTINCT(instance_family) FROM monthly_vcpu_hours_by_account
CREATE OR REPLACE VIEW instance_family_points AS
SELECT 't2' instance_family, 2 points
UNION SELECT 'c5' instance_family, 2 points
UNION SELECT 'm4' instance_family, 2 points
UNION SELECT 'm5' instance_family, 2 points
UNION SELECT 't3' instance_family, 2 points
UNION SELECT 'm5a' instance_family, 2 points
UNION SELECT 't4g' instance_family, 1 points
SELECT instance_family,
region,
account_id,
purchase_option,
SUM(vcpu_hours) vcpu_hours,
year,
month,
SUM(f.points * r.points * vcpu_hours) points
FROM monthly_vcpu_hours_by_account
JOIN region_points r
USING (region)
JOIN instance_family_points f
USING (instance_family)
GROUP BY instance_family, region, account_id, purchase_option, year, month
ORDER BY 8 DESC
Congratulations! You have put additional assumptions into views to extend the usage data by weights. You can now continue with Lab 3 to see how you could add the additional views and tables in an Infrastructure as Code (IaC) approach.
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