こんにちは。AWS CLIが好きな福島です。
- はじめに
- 概要図
- AthenaとQuickSightのイメージ図
- 参考
- ⑩QuickSightでデータの可視化(可視化アカウントで実行)
- QuickSightのコンソールから分析を確認
- データが上手く表示されない場合
- 終わりに
はじめに
今回は以下のブログの続きとなります。
【2/3】マルチアカウント環境のリソース情報を可視化してみる(AWS Config + Athena + QuickSight) - サーバーワークスエンジニアブログ
第1,2弾で可視化のための準備が整ったため、今回は第3弾として、ようやくQuickSightを使いデータを可視化します。
第1弾
①ConfigSnapshotの出力設定(各アカウントで実行)
②AWS Config用S3のバケットポリシー更新(ログアーカイブアカウントで実行)
③AWS Config用のテーブル作成(可視化アカウントで実行)
④AWS Config用のテーブルを更新するLambdaの作成(可視化アカウントで実行)
⑤Lambdaのリソースベースポリシーの設定(可視化アカウントで実行)
⑥S3イベントの設定(ログアーカイブアカウントで実施)
第2弾
⑦可視化したい情報ごとに様々なビューの作成(可視化アカウントで実行)
⑧アカウントIDとアカウント名のテーブル作成(可視化アカウントで実行)
⑨⑦と⑧の結合(可視化アカウントで実行)
第3弾
⑩QuickSightでデータの可視化(可視化アカウントで実行)
概要図
第1弾にも記載している概要図を記載いたします。
AthenaとQuickSightのイメージ図
AthenaとQuickSightのイメージ図は以下の通りです。今回は、QuickSightの部分の構築を行います。 最終的には分析をダッシュボードとして公開することになるかと存じますが、今回は分析を作成するところまでを実施します。
参考
⑩QuickSightでデータの可視化(可視化アカウントで実行)
権限を付与するユーザーの確認
これから作成するデータソース、データセット、分析にアクセスできる権限を付与するユーザーを変数に設定します。
PRINCIPAL_ARN=""
PRINCIPAL_ARNに設定すべき情報が不明な場合は、 QuickSightのユーザー一覧を確認できる以下のコマンドを参考にPRINCIPAL_ARNを設定します。
aws quicksight list-users \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --namespace default \ --query "UserList[].Arn" \ --output text
データソースの作成
ここからデータソースを作成します。
aws quicksight create-data-source \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-source-id data-source-athena \ --name data-source-athena \ --type ATHENA \ --permissions \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:UpdateDataSourcePermissions\", \"quicksight:DescribeDataSourcePermissions\", \"quicksight:PassDataSource\", \"quicksight:DescribeDataSource\", \"quicksight:DeleteDataSource\", \"quicksight:UpdateDataSource\" ] } ]"
この後、データソースのARNが必要になるため、変数に代入しておきます。
DATA_SOURCE_ARN=$(aws quicksight list-data-sources \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --query "DataSources[?DataSourceId=='data-source-athena'].[Arn]" --output text)
データセットの作成
v_config_ec2_instancesのデータセット作成
aws quicksight create-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_ec2_instances \ --name v_config_ec2_instances \ --import-mode DIRECT_QUERY \ --physical-table-map \ "{ \"v-config-ec2-instances\": { \"RelationalTable\": { \"DataSourceArn\": \"$DATA_SOURCE_ARN\", \"Catalog\": \"AwsDataCatalog\", \"Schema\": \"default\", \"Name\": \"v_config_ec2_instances\", \"InputColumns\": [ { \"Name\": \"accountid\", \"Type\": \"STRING\" }, { \"Name\": \"region\", \"Type\": \"STRING\" }, { \"Name\": \"instanceid\", \"Type\": \"STRING\" }, { \"Name\": \"tagname\", \"Type\": \"STRING\" }, { \"Name\": \"lastconfigsnapshot\", \"Type\": \"STRING\" }, { \"Name\": \"creationtime\", \"Type\": \"STRING\" }, { \"Name\": \"launchtime\", \"Type\": \"STRING\" }, { \"Name\": \"instancetype\", \"Type\": \"STRING\" }, { \"Name\": \"keyname\", \"Type\": \"STRING\" }, { \"Name\": \"amiid\", \"Type\": \"STRING\" }, { \"Name\": \"privateip\", \"Type\": \"STRING\" }, { \"Name\": \"publicip\", \"Type\": \"STRING\" }, { \"Name\": \"state\", \"Type\": \"STRING\" } ] } } }" \ --permission \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:CreateIngestion\", \"quicksight:PassDataSet\", \"quicksight:DeleteRefreshSchedule\", \"quicksight:UpdateDataSet\", \"quicksight:UpdateRefreshSchedule\", \"quicksight:DeleteDataSetRefreshProperties\", \"quicksight:CreateRefreshSchedule\", \"quicksight:ListIngestions\", \"quicksight:DescribeDataSetPermissions\", \"quicksight:UpdateDataSetPermissions\", \"quicksight:DescribeIngestion\", \"quicksight:PutDataSetRefreshProperties\", \"quicksight:DeleteDataSet\", \"quicksight:DescribeDataSet\", \"quicksight:CancelIngestion\", \"quicksight:DescribeRefreshSchedule\", \"quicksight:ListRefreshSchedules\", \"quicksight:DescribeDataSetRefreshProperties\" ] } ]"
v_config_ec2_vpcsのデータセット作成
aws quicksight create-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_vpcs \ --name v_config_vpcs \ --import-mode DIRECT_QUERY \ --physical-table-map \ "{ \"v-config-vpcs\": { \"RelationalTable\": { \"DataSourceArn\": \"$DATA_SOURCE_ARN\", \"Catalog\": \"AwsDataCatalog\", \"Schema\": \"default\", \"Name\": \"v_config_vpcs\", \"InputColumns\": [ { \"Name\": \"accountid\", \"Type\": \"STRING\" }, { \"Name\": \"region\", \"Type\": \"STRING\" }, { \"Name\": \"resourceid\", \"Type\": \"STRING\" }, { \"Name\": \"tagname\", \"Type\": \"STRING\" }, { \"Name\": \"isdefault\", \"Type\": \"STRING\" }, { \"Name\": \"cidrblock0\", \"Type\": \"STRING\" }, { \"Name\": \"cidrblock1\", \"Type\": \"STRING\" }, { \"Name\": \"cidrblock2\", \"Type\": \"STRING\" }, { \"Name\": \"cidrblock3\", \"Type\": \"STRING\" }, { \"Name\": \"cidrblock4\", \"Type\": \"STRING\" } ] } } }" \ --permission \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:CreateIngestion\", \"quicksight:PassDataSet\", \"quicksight:DeleteRefreshSchedule\", \"quicksight:UpdateDataSet\", \"quicksight:UpdateRefreshSchedule\", \"quicksight:DeleteDataSetRefreshProperties\", \"quicksight:CreateRefreshSchedule\", \"quicksight:ListIngestions\", \"quicksight:DescribeDataSetPermissions\", \"quicksight:UpdateDataSetPermissions\", \"quicksight:DescribeIngestion\", \"quicksight:PutDataSetRefreshProperties\", \"quicksight:DeleteDataSet\", \"quicksight:DescribeDataSet\", \"quicksight:CancelIngestion\", \"quicksight:DescribeRefreshSchedule\", \"quicksight:ListRefreshSchedules\", \"quicksight:DescribeDataSetRefreshProperties\" ] } ]"
v_config_rds_dbinstancesのデータセット作成
aws quicksight create-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_rds_dbinstances \ --name v_config_rds_dbinstances \ --import-mode DIRECT_QUERY \ --physical-table-map \ "{ \"v-config-rds-dbinstances\": { \"RelationalTable\": { \"DataSourceArn\": \"$DATA_SOURCE_ARN\", \"Catalog\": \"AwsDataCatalog\", \"Schema\": \"default\", \"Name\": \"v_config_rds_dbinstances\", \"InputColumns\": [ { \"Name\": \"accountid\", \"Type\": \"STRING\" }, { \"Name\": \"region\", \"Type\": \"STRING\" }, { \"Name\": \"tagname\", \"Type\": \"STRING\" }, { \"Name\": \"lastconfigsnapshot\", \"Type\": \"STRING\" }, { \"Name\": \"creationtime\", \"Type\": \"STRING\" }, { \"Name\": \"resourcename\", \"Type\": \"STRING\" }, { \"Name\": \"availabilityzone\", \"Type\": \"STRING\" }, { \"Name\": \"endpoint\", \"Type\": \"STRING\" }, { \"Name\": \"engine\", \"Type\": \"STRING\" }, { \"Name\": \"engineversion\", \"Type\": \"STRING\" }, { \"Name\": \"port\", \"Type\": \"STRING\" }, { \"Name\": \"instancetype\", \"Type\": \"STRING\" }, { \"Name\": \"storagetype\", \"Type\": \"STRING\" }, { \"Name\": \"allocatedstorage\", \"Type\": \"STRING\" }, { \"Name\": \"storageencrypted\", \"Type\": \"STRING\" }, { \"Name\": \"backupwindow\", \"Type\": \"STRING\" }, { \"Name\": \"backupretention\", \"Type\": \"STRING\" }, { \"Name\": \"preferredmaintenancewindow\", \"Type\": \"STRING\" }, { \"Name\": \"publiclyaccessible\", \"Type\": \"STRING\" }, { \"Name\": \"status\", \"Type\": \"STRING\" }, { \"Name\": \"deletionprotection\", \"Type\": \"STRING\" } ] } } }" \ --permission \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:CreateIngestion\", \"quicksight:PassDataSet\", \"quicksight:DeleteRefreshSchedule\", \"quicksight:UpdateDataSet\", \"quicksight:UpdateRefreshSchedule\", \"quicksight:DeleteDataSetRefreshProperties\", \"quicksight:CreateRefreshSchedule\", \"quicksight:ListIngestions\", \"quicksight:DescribeDataSetPermissions\", \"quicksight:UpdateDataSetPermissions\", \"quicksight:DescribeIngestion\", \"quicksight:PutDataSetRefreshProperties\", \"quicksight:DeleteDataSet\", \"quicksight:DescribeDataSet\", \"quicksight:CancelIngestion\", \"quicksight:DescribeRefreshSchedule\", \"quicksight:ListRefreshSchedules\", \"quicksight:DescribeDataSetRefreshProperties\" ] } ]"
aws_org_accountsのデータセット作成
aws quicksight create-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id aws_org_accounts \ --name aws_org_accounts \ --import-mode DIRECT_QUERY \ --physical-table-map \ "{ \"v-aws-org-accounts\": { \"RelationalTable\": { \"DataSourceArn\": \"$DATA_SOURCE_ARN\", \"Catalog\": \"AwsDataCatalog\", \"Schema\": \"default\", \"Name\": \"aws_org_accounts\", \"InputColumns\": [ { \"Name\": \"accountid\", \"Type\": \"STRING\" }, { \"Name\": \"name\", \"Type\": \"STRING\" } ] } } }" \ --permission \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:CreateIngestion\", \"quicksight:PassDataSet\", \"quicksight:DeleteRefreshSchedule\", \"quicksight:UpdateDataSet\", \"quicksight:UpdateRefreshSchedule\", \"quicksight:DeleteDataSetRefreshProperties\", \"quicksight:CreateRefreshSchedule\", \"quicksight:ListIngestions\", \"quicksight:DescribeDataSetPermissions\", \"quicksight:UpdateDataSetPermissions\", \"quicksight:DescribeIngestion\", \"quicksight:PutDataSetRefreshProperties\", \"quicksight:DeleteDataSet\", \"quicksight:DescribeDataSet\", \"quicksight:CancelIngestion\", \"quicksight:DescribeRefreshSchedule\", \"quicksight:ListRefreshSchedules\", \"quicksight:DescribeDataSetRefreshProperties\" ] } ]"
分析の作成
各データセットのARNの取得
## EC2 EC2_DATA_SET_ARN=$(aws quicksight describe-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_ec2_instances \ --query "DataSet.Arn" --output text) ## VPC VPC_DATA_SET_ARN=$(aws quicksight describe-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_vpcs \ --query "DataSet.Arn" --output text) ## RDS RDS_DATA_SET_ARN=$(aws quicksight describe-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id v_config_rds_dbinstances \ --query "DataSet.Arn" --output text) ## Account ACCOUNT_DATA_SET_ARN=$(aws quicksight describe-data-set \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --data-set-id aws_org_accounts \ --query "DataSet.Arn" --output text)
分析の作成
aws quicksight create-analysis \ --aws-account-id $(aws sts get-caller-identity --query "Account" --output text) \ --name config-analysis \ --analysis-id config-analysis \ --definition \ "{ \"DataSetIdentifierDeclarations\": [ { \"Identifier\": \"v_config_ec2_instances\", \"DataSetArn\": \"$EC2_DATA_SET_ARN\" }, { \"Identifier\": \"v_config_ec2_vpcs\", \"DataSetArn\": \"$VPC_DATA_SET_ARN\" }, { \"Identifier\": \"v_config_rds_dbinstances-1\", \"DataSetArn\": \"$RDS_DATA_SET_ARN\" }, { \"Identifier\": \"aws_org_accounts\", \"DataSetArn\": \"$ACCOUNT_DATA_SET_ARN\" } ], \"Sheets\": [ { \"SheetId\": \"4fcc7cda-0bc9-4232-a632-40e33ed95f12\", \"Name\": \"シート 1\", \"Visuals\": [ { \"TableVisual\": { \"VisualId\": \"98017c72-a554-4135-925a-805ca5910a30\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>RDS一覧</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"TableAggregatedFieldWells\": { \"GroupBy\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.resourcename.2.1681345263932\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"resourcename\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.accountid.1.1681345254718\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"accountid\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.instancetype.3.1681345265783\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"instancetype\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.endpoint.4.1681345267343\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"endpoint\" } } } ], \"Values\": [] } }, \"SortConfiguration\": {}, \"TableOptions\": { \"HeaderStyle\": { \"TextWrap\": \"WRAP\", \"Height\": 25 } }, \"FieldOptions\": { \"SelectedFieldOptions\": [], \"Order\": [ \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.resourcename.2.1681345263932\", \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.accountid.1.1681345254718\", \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.instancetype.3.1681345265783\", \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.endpoint.4.1681345267343\" ] } }, \"Actions\": [] } }, { \"TableVisual\": { \"VisualId\": \"d9713eb0-f219-4569-b72e-1fe6f2bd4787\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>VPC一覧</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"TableAggregatedFieldWells\": { \"GroupBy\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.tagname.1.1681292876094\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"tagname\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.accountid.0.1681292866141\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"accountid\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.resourceid.2.1681292879010\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"resourceid\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock0.3.1681292882751\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"cidrblock0\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock1.4.1681292883427\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"cidrblock1\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock2.5.1681292884051\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"cidrblock2\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock3.6.1681292884537\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"cidrblock3\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock4.7.1681292884962\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"cidrblock4\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"RowSort\": [ { \"FieldSort\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.tagname.1.1681292876094\", \"Direction\": \"ASC\" } } ] }, \"TableOptions\": { \"HeaderStyle\": { \"TextWrap\": \"WRAP\", \"Height\": 25 }, \"CellStyle\": { \"Height\": 25 } }, \"FieldOptions\": { \"SelectedFieldOptions\": [ { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.tagname.1.1681292876094\", \"Width\": \"286px\" } ], \"Order\": [ \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.tagname.1.1681292876094\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.accountid.0.1681292866141\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.resourceid.2.1681292879010\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock0.3.1681292882751\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock1.4.1681292883427\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock2.5.1681292884051\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock3.6.1681292884537\", \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.cidrblock4.7.1681292884962\" ] } }, \"Actions\": [] } }, { \"TableVisual\": { \"VisualId\": \"ad4a7334-2e2a-423e-8176-a9e29330c5f1\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>EC2一覧</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"TableAggregatedFieldWells\": { \"GroupBy\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.tagname.0.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"tagname\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.accountid.1.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"accountid\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.instanceid.2.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"instanceid\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.instancetype.3.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"instancetype\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.privateip.4.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"privateip\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.amiid.5.1681292956309\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"amiid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"RowSort\": [ { \"ColumnSort\": { \"SortBy\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"accountid\" }, \"Direction\": \"DESC\", \"AggregationFunction\": { \"CategoricalAggregationFunction\": \"DISTINCT_COUNT\" } } } ] }, \"TableOptions\": { \"HeaderStyle\": { \"TextWrap\": \"WRAP\", \"Height\": 25 }, \"CellStyle\": { \"Height\": 25 } }, \"FieldOptions\": { \"SelectedFieldOptions\": [ { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.tagname.0.1681292956309\", \"Width\": \"105px\" } ], \"Order\": [] } }, \"Actions\": [] } }, { \"BarChartVisual\": { \"VisualId\": \"b48c7b2c-8df7-458a-a517-912226e8a32a\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>EC2の稼働状況</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"BarChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.state.0.1681293658817\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"state\" } } } ], \"Values\": [], \"Colors\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"ColorItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"Orientation\": \"HORIZONTAL\", \"BarsArrangement\": \"CLUSTERED\", \"DataLabels\": { \"Visibility\": \"HIDDEN\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.state.0.1681293658817\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"BarChartVisual\": { \"VisualId\": \"bb08796f-d852-4b02-a398-e943727decfc\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>RDSの稼働状況</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"BarChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.status.0.1681293682680\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"status\" } } } ], \"Values\": [], \"Colors\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"ColorItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"Orientation\": \"HORIZONTAL\", \"BarsArrangement\": \"CLUSTERED\", \"DataLabels\": { \"Visibility\": \"HIDDEN\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.status.0.1681293682680\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"1a88517e-6640-401a-ab7c-d9a2556f46d0\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>EC2のインスタンスタイプの割合</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.instancetype.0.1681293926241\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"instancetype\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"WHOLE\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.instancetype.0.1681293926241\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"3e488e66-5907-4ed1-bf2f-b3bd732829c9\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>RDSのインスタンスクラスの割合</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.instancetype.0.1681293970191\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"instancetype\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"WHOLE\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.instancetype.0.1681293970191\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"e60e3700-856c-417e-9b1f-7fec01aa2d31\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>EC2の総数</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.accountid.0.1681346065020\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_instances\", \"ColumnName\": \"accountid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"MEDIUM\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"0facbf94-3cd8-41d3-909b-9b4b975ff429.accountid.0.1681346065020\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"159cf2f4-9c69-4d00-9af4-4c883ded3ae7\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>RDSの総数</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.accountid.0.1681346131540\", \"Column\": { \"DataSetIdentifier\": \"v_config_rds_dbinstances-1\", \"ColumnName\": \"accountid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"MEDIUM\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"9d49fabc-b1c3-4ac3-8abf-1da40444c224.accountid.0.1681346131540\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"3d733e6f-a5ec-4c7c-a26d-2b790c223a86\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>VPCの総数</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.accountid.0.1681346183310\", \"Column\": { \"DataSetIdentifier\": \"v_config_ec2_vpcs\", \"ColumnName\": \"accountid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"MEDIUM\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"7bd53ef9-24f1-4f39-939d-8ea863be86a2.accountid.0.1681346183310\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"PieChartVisual\": { \"VisualId\": \"8b510a1c-0de6-4299-8e4d-d05508c2e665\", \"Title\": { \"Visibility\": \"VISIBLE\", \"FormatText\": { \"RichText\": \"<visual-title>AWSアカ ウントの総数</visual-title>\" } }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"PieChartAggregatedFieldWells\": { \"Category\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"424e40d7-21fe-41da-b891-c79468eb72a5.accountid.1.1681365823475\", \"Column\": { \"DataSetIdentifier\": \"aws_org_accounts\", \"ColumnName\": \"accountid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": { \"CategoryItemsLimit\": { \"OtherCategories\": \"INCLUDE\" }, \"SmallMultiplesLimitConfiguration\": { \"OtherCategories\": \"INCLUDE\" } }, \"DonutOptions\": { \"ArcOptions\": { \"ArcThickness\": \"MEDIUM\" } }, \"DataLabels\": { \"Visibility\": \"VISIBLE\", \"Overlap\": \"DISABLE_OVERLAP\" }, \"Tooltip\": { \"TooltipVisibility\": \"VISIBLE\", \"SelectedTooltipType\": \"BASIC\", \"FieldBasedTooltip\": { \"AggregationVisibility\": \"HIDDEN\", \"TooltipTitleType\": \"PRIMARY_VALUE\", \"TooltipFields\": [ { \"FieldTooltipItem\": { \"FieldId\": \"424e40d7-21fe-41da-b891-c79468eb72a5.accountid.1.1681365823475\", \"Visibility\": \"VISIBLE\" } } ] } } }, \"Actions\": [], \"ColumnHierarchies\": [] } }, { \"TableVisual\": { \"VisualId\": \"a5068b8a-63af-48b4-a486-fcd3f4c4bb49\", \"Title\": { \"Visibility\": \"VISIBLE\" }, \"Subtitle\": { \"Visibility\": \"VISIBLE\" }, \"ChartConfiguration\": { \"FieldWells\": { \"TableAggregatedFieldWells\": { \"GroupBy\": [ { \"CategoricalDimensionField\": { \"FieldId\": \"424e40d7-21fe-41da-b891-c79468eb72a5.name.1.1681365898279\", \"Column\": { \"DataSetIdentifier\": \"aws_org_accounts\", \"ColumnName\": \"name\" } } }, { \"CategoricalDimensionField\": { \"FieldId\": \"424e40d7-21fe-41da-b891-c79468eb72a5.accountid.0.1681365898279\", \"Column\": { \"DataSetIdentifier\": \"aws_org_accounts\", \"ColumnName\": \"accountid\" } } } ], \"Values\": [] } }, \"SortConfiguration\": {} }, \"Actions\": [] } } ], \"Layouts\": [ { \"Configuration\": { \"GridLayout\": { \"Elements\": [ { \"ElementId\": \"8b510a1c-0de6-4299-8e4d-d05508c2e665\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 0, \"ColumnSpan\": 7, \"RowIndex\": 0, \"RowSpan\": 9 }, { \"ElementId\": \"3d733e6f-a5ec-4c7c-a26d-2b790c223a86\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 7, \"ColumnSpan\": 9, \"RowIndex\": 0, \"RowSpan\": 9 }, { \"ElementId\": \"e60e3700-856c-417e-9b1f-7fec01aa2d31\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 16, \"ColumnSpan\": 10, \"RowIndex\": 0, \"RowSpan\": 9 }, { \"ElementId\": \"159cf2f4-9c69-4d00-9af4-4c883ded3ae7\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 26, \"ColumnSpan\": 10, \"RowIndex\": 0, \"RowSpan\": 9 }, { \"ElementId\": \"a5068b8a-63af-48b4-a486-fcd3f4c4bb49\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 0, \"ColumnSpan\": 7, \"RowIndex\": 9, \"RowSpan\": 8 }, { \"ElementId\": \"1a88517e-6640-401a-ab7c-d9a2556f46d0\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 7, \"ColumnSpan\": 12, \"RowIndex\": 9, \"RowSpan\": 8 }, { \"ElementId\": \"3e488e66-5907-4ed1-bf2f-b3bd732829c9\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 19, \"ColumnSpan\": 17, \"RowIndex\": 9, \"RowSpan\": 8 }, { \"ElementId\": \"b48c7b2c-8df7-458a-a517-912226e8a32a\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 0, \"ColumnSpan\": 18, \"RowIndex\": 17, \"RowSpan\": 4 }, { \"ElementId\": \"bb08796f-d852-4b02-a398-e943727decfc\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 18, \"ColumnSpan\": 18, \"RowIndex\": 17, \"RowSpan\": 4 }, { \"ElementId\": \"ad4a7334-2e2a-423e-8176-a9e29330c5f1\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 0, \"ColumnSpan\": 18, \"RowIndex\": 21, \"RowSpan\": 5 }, { \"ElementId\": \"98017c72-a554-4135-925a-805ca5910a30\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 18, \"ColumnSpan\": 18, \"RowIndex\": 21, \"RowSpan\": 5 }, { \"ElementId\": \"d9713eb0-f219-4569-b72e-1fe6f2bd4787\", \"ElementType\": \"VISUAL\", \"ColumnIndex\": 0, \"ColumnSpan\": 23, \"RowIndex\": 26, \"RowSpan\": 4 } ] } } } ], \"ContentType\": \"INTERACTIVE\" } ], \"CalculatedFields\": [], \"ParameterDeclarations\": [], \"FilterGroups\": [], \"AnalysisDefaults\": { \"DefaultNewSheetConfiguration\": { \"InteractiveLayoutConfiguration\": { \"Grid\": { \"CanvasSizeOptions\": { \"ScreenCanvasSizeOptions\": { \"ResizeOption\": \"FIXED\", \"OptimizedViewPortWidth\": \"1600px\" } } } }, \"SheetContentType\": \"INTERACTIVE\" } } }" \ --permission \ "[ { \"Principal\": \"$PRINCIPAL_ARN\", \"Actions\": [ \"quicksight:RestoreAnalysis\", \"quicksight:UpdateAnalysisPermissions\", \"quicksight:DeleteAnalysis\", \"quicksight:DescribeAnalysisPermissions\", \"quicksight:QueryAnalysis\", \"quicksight:DescribeAnalysis\", \"quicksight:UpdateAnalysis\" ] } ]"
QuickSightのコンソールから分析を確認
QuickSightのコンソールから作成した分析を確認すると、冒頭に記載した画像のような可視化ができていることが分かるかと存じます。
データが上手く表示されない場合
もし以下のようなエラーで可視化が上手くできない場合は、QuickSightのアクセス権限が不足している可能性があります。
「QuickSightの管理」から「セキュリティとアクセス権限」の管理を確認します。
必要なS3バケットへのアクセス権を付与すれば、データが見れるはずです。
終わりに
今回は3回に分けてマルチアカウント環境のリソース情報を可視化する方法をご紹介いたしました。 これからはもっと最適な可視化ができないかを追求していきたいと思います。
第一弾、第二弾
【1/3】マルチアカウント環境のリソース情報を可視化してみる(AWS Config + Athena + QuickSight) - サーバーワークスエンジニアブログ
【2/3】マルチアカウント環境のリソース情報を可視化してみる(AWS Config + Athena + QuickSight) - サーバーワークスエンジニアブログ