AWS无法对CLI执行操作

时间:2020-01-03 14:02:41

标签: boto3 amazon-iam aws-cli aws-cloudwatch-log-insights

我能够在AWS控制台上执行一些操作(特别是使用cloudwatch洞察力并运行查询)。但是我无法使用aws cli或boto3(aws日志开始查询)来执行相同操作。它给出了AccessDeniedError。但是我能够运行其他命令,例如aws s3 ls。控制台和cli的权限是否相同?

确切错误是

An error occurred (AccessDeniedException) when calling the StartQuery operation: User: arn:aws:sts::----:assumed-role/---- is not authorized to perform: logs:StartQuery on resource: arn:aws:logs:----

我应该如何调试此问题。

1 个答案:

答案 0 :(得分:0)

这意味着您使用的cli用户没有logs:StartQuery操作的权限。

出于测试目的,您可以将预定义策略CloudWatchLogsFullAccess授予cli用户。有关更细粒度的权限,请检查:CloudWatch Logs Permissions Reference