# 推奨する読み取り専用の権限

日常の読み取り専用利用のための、コピーできるIAMポリシーとIAM Identity Centerの許可セット。

CloudConsoleは、認証情報で許可されていることを、それ以上でも以下でもなく実行します。アラーム、ログ、コスト、リソースの確認には、読み取り専用のロールを与えましょう。書き込み権限は、必要なときに切り替える別のロールに分けるか、アプリでアカウントを読み取り専用にします。

## 方法1：AWS管理ポリシーReadOnlyAccess（最も簡単）

AWS管理ポリシー`ReadOnlyAccess`（`arn:aws:iam::aws:policy/ReadOnlyAccess`）をアタッチします。Cloud Controlで読み取る約110のサービスを含め、アプリのすべての画面をカバーします。ただし、S3バケット内のオブジェクトやDynamoDBテーブルの項目など、データの読み取りも許可される点に注意してください。

## 方法2：CloudConsoleの読み取り専用ポリシー（最も厳密）

ここにあるのは、アプリ自身の画面が行う読み取りの呼び出しだけで、それ以外はありません。2 つ目のステートメントはデータの読み取り（S3 オブジェクトのプレビューと DynamoDB の項目）のためのもので、不要なら省いてください。カスタマーマネージドの KMS キーで暗号化されたオブジェクトには、そのキーに対する `kms:Decrypt` も必要です（[S3 オブジェクトのプレビュー](https://cloudconsole.dev/ja/help/preview-s3-objects)を参照）。

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "CloudConsoleRead",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeRegions",
        "ec2:DescribeInstances",
        "ec2:DescribeInstanceAttribute",
        "ec2:DescribeVolumes",
        "ec2:DescribeSnapshots",
        "ec2:DescribeAddresses",
        "ec2:DescribeImages",
        "ec2:DescribeNatGateways",
        "elasticloadbalancing:DescribeLoadBalancers",
        "elasticloadbalancing:DescribeTargetGroups",
        "elasticloadbalancing:DescribeTargetHealth",
        "autoscaling:DescribeAutoScalingGroups",
        "autoscaling:DescribeInstanceRefreshes",
        "autoscaling:DescribeScalingActivities",
        "lambda:ListFunctions",
        "lambda:GetFunction",
        "lambda:GetFunctionConfiguration",
        "lambda:ListVersionsByFunction",
        "lambda:ListAliases",
        "s3:ListAllMyBuckets",
        "s3:GetBucketLocation",
        "s3:ListBucket",
        "s3:GetBucketVersioning",
        "s3:GetBucketPublicAccessBlock",
        "s3:GetEncryptionConfiguration",
        "s3:GetBucketRequestPayment",
        "rds:DescribeDBInstances",
        "rds:DescribeOrderableDBInstanceOptions",
        "ecs:ListClusters",
        "ecs:DescribeClusters",
        "ecs:ListServices",
        "ecs:DescribeServices",
        "ecs:ListTasks",
        "ecs:DescribeTasks",
        "ecs:ListTaskDefinitions",
        "ecs:DescribeTaskDefinition",
        "cloudwatch:DescribeAlarms",
        "cloudwatch:DescribeAlarmHistory",
        "cloudwatch:GetMetricData",
        "logs:DescribeLogGroups",
        "logs:DescribeLogStreams",
        "logs:FilterLogEvents",
        "logs:GetLogEvents",
        "logs:GetLogRecord",
        "logs:DescribeQueryDefinitions",
        "logs:StartQuery",
        "logs:GetQueryResults",
        "logs:StopQuery",
        "ce:GetCostAndUsage",
        "ce:GetCostForecast",
        "codepipeline:ListPipelines",
        "codepipeline:GetPipeline",
        "codepipeline:GetPipelineState",
        "codepipeline:ListPipelineExecutions",
        "cloudformation:ListStacks",
        "cloudformation:DescribeStacks",
        "cloudformation:DescribeStackEvents",
        "cloudformation:ListStackResources",
        "cloudtrail:LookupEvents",
        "sqs:ListQueues",
        "sqs:GetQueueAttributes",
        "sqs:ListDeadLetterSourceQueues",
        "sqs:ListMessageMoveTasks",
        "states:ListStateMachines",
        "states:DescribeStateMachine",
        "states:ListExecutions",
        "states:DescribeExecution",
        "states:GetExecutionHistory",
        "events:ListEventBuses",
        "events:ListRules",
        "events:DescribeRule",
        "events:ListTargetsByRule",
        "dynamodb:ListTables",
        "dynamodb:DescribeTable",
        "dynamodb:DescribeContinuousBackups",
        "dynamodb:DescribeTimeToLive",
        "iam:GetAccountSummary",
        "iam:ListUsers",
        "iam:GetUser",
        "iam:ListUserTags",
        "iam:GetLoginProfile",
        "iam:ListAccessKeys",
        "iam:GetAccessKeyLastUsed",
        "iam:ListMFADevices",
        "iam:ListGroupsForUser",
        "iam:ListAttachedUserPolicies",
        "iam:ListUserPolicies",
        "iam:ListRoles",
        "iam:GetRole",
        "iam:ListAttachedRolePolicies",
        "iam:ListRolePolicies",
        "iam:ListPolicies",
        "iam:GetPolicy",
        "iam:GetPolicyVersion",
        "secretsmanager:ListSecrets",
        "secretsmanager:DescribeSecret",
        "route53:ListHostedZones",
        "route53:GetHostedZone",
        "route53:ListResourceRecordSets",
        "route53:ListHealthChecks",
        "route53:GetHealthCheckStatus",
        "cloudfront:ListDistributions",
        "cloudfront:GetDistribution",
        "cloudfront:ListInvalidations",
        "cloudfront:GetInvalidation",
        "apigateway:GET",
        "health:DescribeEvents",
        "health:DescribeEventDetails",
        "health:DescribeAffectedEntities",
        "acm:ListCertificates",
        "acm:DescribeCertificate",
        "ssm:DescribeParameters",
        "ssm:DescribeInstanceInformation",
        "ssm:ListCommands",
        "ssm:ListCommandInvocations",
        "ssm:GetCommandInvocation",
        "codebuild:ListProjects",
        "codebuild:BatchGetProjects",
        "codebuild:ListBuildsForProject",
        "codebuild:ListBuilds",
        "codebuild:BatchGetBuilds",
        "cloudformation:ListResources",
        "cloudformation:GetResource",
        "cloudformation:DescribeType",
        "tag:GetResources",
        "sns:ListTopics",
        "ec2:DescribeVpcs",
        "ec2:DescribeSubnets",
        "ec2:DescribeNetworkInterfaces",
        "ec2:DescribeVpcPeeringConnections",
        "ec2:DescribeTransitGatewayVpcAttachments",
        "scheduler:ListSchedules",
        "scheduler:GetSchedule",
        "servicequotas:ListServiceQuotas",
        "servicequotas:GetServiceQuota",
        "s3:GetBucketPolicyStatus",
        "s3:GetLifecycleConfiguration",
        "s3:GetBucketLogging",
        "s3:GetAccountPublicAccessBlock",
        "pricing:GetProducts",
        "cloudformation:GetTemplate",
        "cloudformation:DescribeStackResources",
        "ec2:DescribeLaunchTemplates",
        "ec2:DescribeLaunchTemplateVersions",
        "autoscaling:DescribePolicies",
        "autoscaling:DescribeScheduledActions",
        "budgets:ViewBudget",
        "logs:ListTagsLogGroup",
        "logs:ListTagsForResource"
      ],
      "Resource": "*"
    },
    {
      "Sid": "CloudConsoleReadData",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "dynamodb:Scan",
        "dynamodb:Query",
        "ssm:GetParameter",
        "ssm:GetParametersByPath",
        "ssm:GetParameterHistory"
      ],
      "Resource": "*"
    }
  ]
}
```

このポリシーは、Cloud Controlで閲覧する読み取り専用のサービス（Elastic Beanstalk、KMS、SNSなど）をカバーしていません。それらには、各サービス固有の`List*`と`Describe*`または`Get*`の権限も必要です。[対応サービス](https://cloudconsole.dev/ja/help/services)をご覧ください。

## 方法3：ViewOnlyAccessと追加の権限

職務機能のAWS管理ポリシー`ViewOnlyAccess`はリソースを一覧表示できますが、ログイベントの読み取り、ログのクエリ、コストの読み取りは意図的に許可していません。次のステートメントと一緒にアタッチしてください。

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "CloudConsoleExtras",
      "Effect": "Allow",
      "Action": [
        "logs:FilterLogEvents",
        "logs:GetLogEvents",
        "logs:GetLogRecord",
        "logs:DescribeQueryDefinitions",
        "logs:StartQuery",
        "logs:GetQueryResults",
        "logs:StopQuery",
        "cloudwatch:GetMetricData",
        "cloudwatch:DescribeAlarmHistory",
        "ce:GetCostAndUsage",
        "ce:GetCostForecast",
        "cloudtrail:LookupEvents",
        "cloudformation:ListResources",
        "cloudformation:GetResource",
        "cloudformation:DescribeType",
        "tag:GetResources",
        "sns:ListTopics",
        "health:DescribeEvents",
        "health:DescribeEventDetails",
        "health:DescribeAffectedEntities",
        "scheduler:ListSchedules",
        "scheduler:GetSchedule",
        "servicequotas:ListServiceQuotas",
        "servicequotas:GetServiceQuota",
        "s3:GetBucketPublicAccessBlock",
        "s3:GetBucketPolicyStatus",
        "s3:GetBucketVersioning",
        "s3:GetEncryptionConfiguration",
        "s3:GetLifecycleConfiguration",
        "s3:GetBucketLogging",
        "s3:GetAccountPublicAccessBlock",
        "iam:GetAccessKeyLastUsed",
        "pricing:GetProducts",
        "ssm:DescribeParameters",
        "ssm:GetParameter",
        "ssm:GetParametersByPath",
        "ssm:GetParameterHistory",
        "ssm:DescribeInstanceInformation",
        "ssm:ListCommands",
        "ssm:ListCommandInvocations",
        "ssm:GetCommandInvocation",
        "codebuild:BatchGetProjects",
        "codebuild:BatchGetBuilds"
      ],
      "Resource": "*"
    }
  ]
}
```

## IAM Identity Centerの許可セットとして

IAM Identity Centerのコンソールで許可セットを作成します。定義済みの*ReadOnlyAccess*を選ぶか、カスタムの許可セットを作成して方法2をインラインポリシーとして貼り付けます。そのうえで、各アカウントのユーザーまたはグループに割り当てます。CLIの場合：

```
# 1. Create the permission set (use your Identity Center instance ARN)
aws sso-admin create-permission-set \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --name CloudConsoleReadOnly \
  --session-duration PT8H

# 2a. Either attach the AWS managed ReadOnlyAccess policy...
aws sso-admin attach-managed-policy-to-permission-set \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --permission-set-arn arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef \
  --managed-policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

# 2b. ...or use the CloudConsole read-only policy above as an inline policy
aws sso-admin put-inline-policy-to-permission-set \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --permission-set-arn arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef \
  --inline-policy file://cloudconsole-readonly.json

# 3. Give a group access to an account with it
aws sso-admin create-account-assignment \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --target-id 123456789012 --target-type AWS_ACCOUNT \
  --permission-set-arn arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef \
  --principal-type GROUP --principal-id 1234567890-abcd1234-5678-90ab-cdef-1234567890ab
```

## アクセスキーを使うIAMユーザーの場合

```
aws iam create-policy --policy-name CloudConsoleReadOnly \
  --policy-document file://cloudconsole-readonly.json
aws iam attach-user-policy --user-name cloudconsole \
  --policy-arn arn:aws:iam::123456789012:policy/CloudConsoleReadOnly
```

## 読み取り専用でも料金がかかるもの

- **Cost Explorer**：AWSはリクエストごとに$0.01を請求します。アプリが呼び出す頻度は[コスト](https://cloudconsole.dev/ja/help/costs)をご覧ください。料金をかけたくない場合は`ce:*`を外してください。
- **Logs Insights**：スキャンしたログのGB単位でAWSが請求します。使わせたくない場合は`logs:StartQuery`を外してください。

アプリから変更も行う場合は、[変更に必要な権限](https://cloudconsole.dev/ja/help/permissions-for-changes)をご覧ください。

## よくある質問

### CloudConsoleに管理者権限は必要ですか？

いいえ。変更以外はすべて読み取り専用のロールで足ります。変更の場合も、変更に必要な権限の記事に記載した個別の操作だけが必要です。

### なぜcloudformation:ListResourcesが必要なのですか？

約110のサービスはAWS Cloud Controlを通じて読み取ります。Cloud Controlの一覧と取得の呼び出しは、各サービス固有の読み取り権限に加えて、cloudformation:ListResourcesとcloudformation:GetResourceとして認可されるためです。

### 不足している権限を確認できますか？

はい。Account → Safety → Access checkが、サービスごとに読み取り呼び出しを1回行い、許可されているか拒否されているかを表示します。

**解決しない場合**

試したことと、アプリに表示されたメッセージを添えて[support@cloudconsole.dev](mailto:support@cloudconsole.dev)までメールでお問い合わせください。アクセスキーやシークレットは送らないでください。2営業日以内にご返信します。

## 関連ページ

- [変更に必要な権限（Proの操作）](https://cloudconsole.dev/ja/help/permissions-for-changes) – 権限とエラー
- [ロールでできることを確認する（Access check）](https://cloudconsole.dev/ja/help/access-check) – 権限とエラー
- [「No permission」などのアクセスエラーを理解する](https://cloudconsole.dev/ja/help/access-denied) – 権限とエラー
- [IAM Identity Center（AWS SSO）でサインインする](https://cloudconsole.dev/ja/help/connect-with-sso) – AWSアカウントの接続

[すべてのヘルプトピック →](https://cloudconsole.dev/ja/help/)

---

Source: https://cloudconsole.dev/ja/help/recommended-permissions

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
