I want to use Amazon QuickSight to manage and view patch and association compliance data for AWS Systems Manager.
Resolution
Configure the prerequisite services
Before you use Amazon QuickSight to manage and view compliance data, set up Systems Manager Inventory and resource data sync in your AWS account.
You can use the resource data sync setup for multiple accounts and AWS Regions, and synchronize the data to a central Amazon Simple Storage Service (Amazon S3) bucket.
Systems Manager Inventory uses AWS Glue to aggregate the inventory data in the S3 bucket. AWS Glue uses the Amazon-GlueServiceRoleForSSM role to aggregate the data. If the S3 bucket is encrypted with AWS Key Management Service (AWS KMS) keys, then edit the Amazon-GlueServiceRoleForSSM role permissions to use AWS KMS keys. You must also configure your Identity and Access Management (IAM) account for AWS KMS encryption.
By default, AWS Glue crawler aggregates the inventory data in the central S3 bucket twice daily. So, data is updated based on this schedule. To modify the frequency, edit the AWS Glue crawler schedule.
Amazon Athena queries data that you can view on the Detailed View page of the Systems Manager console. You can view this data only in the Regions where Amazon Athena is available. To join multiple Amazon Athena tables, create a joined dataset in QuickSight.
After you set up Systems Manager inventory, resource data sync, AWS Glue and Amazon Athena access, you can set up your QuickSight account.
Set up a QuickSight account
If you don't have a QuickSight account, then complete the following steps:
- Use an IAM identity that has QuickSight permissions to sign in to the AWS Management Console.
- Navigate to Amazon QuickSight.
- Choose Enterprise or Enterprise + Q.
-or-
Choose Sign up for Standard Edition.
- Select the appropriate IAM identity.
- Under QuickSight access to AWS services, select Amazon Athena and Amazon S3.
- For Select Amazon S3 buckets, select the target S3 bucket where inventory data is stored. To give write permission for Athena Workgroup, select Write permission for Athena Workgroup.
- Choose Finish.
If you have an existing QuickSight account, then complete the following steps:
- Open the QuickSight console.
- Choose Manage QuickSight.
- Choose Security & permissions.
- Under QuickSight access to AWS services, choose Add or remove.
- Select Amazon Athena and Amazon S3.
- Choose Update.
Create a dataset in QuickSight
To create datasets in QuickSight, you can use Amazon Athena tables as the source. You can view these tables in Amazon Athena. Each inventory metadata has a corresponding Amazon Athena table that AWS Glue created. To create the dataset and analyze the data, use the aws_compliancesummary and aws_complianceitem tables.
Complete the following steps:
- Open the QuickSight console.
- In the navigation pane, choose Datasets.
- On the Datasets page, choose New dataset.
- Under Create a dataset, select Athena as the data source.
- Enter the data source name.
- Choose Create data source.
- From the dropdown list of databases, select the S3 bucket.
Note: The database name is in the S3_bucket_name-region-database format.
- From the list of tables, select aws_compliancesummary.
- Choose Select.
- Select Directly query your data.
- Choose Edit/Preview data.
- Choose Save and publish.
Repeat the preceding steps to create another dataset for the aws_complianceitem table.
Analyze the dataset
To use the aws_compliancesummary and aws_complianceitem datasets for data analysis, complete the following steps:
- Open the QuickSight console.
- Choose New analysis.
- On the Datasets page, choose aws_compliancesummary.
- Choose USE IN ANALYSIS.
- To add multiple datasets in the same analysis, choose Edit.
- In the pop-up window that appears, choose Add dataset.
- From the dropdown list, choose aws_complianceitem.
- Choose Select.
Note: You can also add other datasets to the same analysis to create the visuals.
Add visuals
You can add a visual to your Amazon QuickSight analysis based on the QuickSight dataset. The dataset includes the tables from Amazon Athena that have the Systems Manager inventory data with compliance information.
Visuals for aws_compliancesummary
To view the number of resources based on patch compliance status, complete the following steps:
- Open the QuickSight console.
- Choose the analysis that you want to add a visual to.
- On the Analysis page, choose the dataset that you want to use.
- Choose Visualize.
- On the Visualize pane, choose Add, and then choose Add visual.
- Choose Visual types.
- On the Visual types pane, select Donut chart.
- From the Fields list, choose Status to add it to Group/Color dimension.
- Under Value, drag and drop Resourceid.
- To count distinct values, next to the resourceid field, choose the arrow.
- Choose Aggregate: Count.
- Choose Count distinct.
- Select the graph.
- Choose Format Visual icon.
- Under Data labels, choose Show metric.
To view the compliant or non-compliant instances by Region, complete the following steps:
- Choose the preceding visual.
- Choose the More information icon on the chart.
- Choose Duplicate visual.
- Under Field wells, in the Group/Color dimension dropdown list, choose Region.
- Choose Filter.
- Choose ADD FILTER.
- Select Status.
- Select COMPLIANT or NON-COMPLIANT.
- Choose Apply.
To view the account information for all accounts in a multi-account setup, use the preceding visual. Under Fields wells, in the Group/Color dimension, select accountid.
Visuals for aws_complianceitem dataset
To view the list of missing patches by instances, complete the following steps:
- Open the QuickSight console.
- Choose Visualize.
- In the Visualize pane, choose Visual types.
- In the Visual types pane, select Donut chart.
- In Visual types, select Pivot table.
- Under Rows, add the following values:
Region
resourceid
patchstate
id
title
- Under Values, add id.
- To count distinct values, choose the arrow next to id.
- Choose Aggregate: Count.
- Choose Count distinct.
- Choose Filter.
- In Filter, choose Add Filter.
- Choose Patchstate.
- Select Missing.
- Choose Apply.
To view the list of instances by compliance status, do the following:
- Open the QuickSight console.
- Choose New Analysis.
- On the Datasets page, in the pop-up window that appears, choose Add dataset.
- Choose aws_complianceitem.
- Choose Add.
- Choose Add visual.
- In Visual types, select Pivot table.
- Under Rows, add the following values:
Region
resourceid
patchstate
id
title
- Under Values, add id.
- To count distinct values, choose the arrow next to id.
- Choose Aggregate: Count.
- Choose Count distinct.
To get information about all accounts, under Rows, add accountid.
Add filters
You can also add filters to filter the data based on compliance type, such as patch compliance and association compliance.
To add filters, complete the following steps:
- Open the QuickSight console.
- In the navigation pane, choose Filter.
- Under Filters, choose Add filter.
- Select Compliance type.
- To include only patch compliance, choose Patch from the list.
- From the Applied to dropdown list, select all applicable visuals.
- Choose Apply.
Publish a dashboard
You can publish all the visuals as a dashboard to share with other users.
Complete the following steps:
- After you add all the visuals, in the application bar, choose Themes.
- Select the appropriate theme.
- Choose Share.
- Select Publish Dashboard.
- Enter a name for the dashboard.
- Choose Publish dashboard.