AWS-IoT:调用获取注册码时拒绝访问异常
AWS-IoT: Access denied exception when calling get-registration-code
我正在按照步骤在 AWS-IoT 中注册设备。我正在执行描述的步骤 by AWS to use a self-signed certificate。教程第三步指示如下命令:
aws iot get-registration-code
但我收到以下异常:
$ aws iot get-registration-code
An error occurred (AccessDeniedException) when calling the
GetRegistrationCode operation: User: arn:aws:iam::xxxxxxxx:user/dalton
is not authorized to perform: iot:GetRegistrationCode on resource: *
不清楚如何分配正确的权限。在 IAM 管理控制台,我为我的用户分配了以下权限:
AWSIoTThingsRegistration
AWSIoTLogging
AWSIoTConfigAccess
AWSIoTRuleActions
AWSIoTConfigReadOnlyAccess
AWSQuickSightIoTAnalyticsAccess
AWSIoTOTAUpdate
AWSIoTDataAccess
AWSIoTFullAccess
仍然没有成功。
AWSIoTFullAccess 定义此策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:*"
],
"Resource": "*"
}
]
}
因此,您将能够根据 IAM IoT policies 执行调用。附加新策略时,只需几秒钟即可在 CLI 上生效。
您需要:
- 仔细检查您的 IAM 策略并确保使用 CLI 的用户确实使用与具有 AWSIoTFullAccess 的 IAM 用户匹配的 aws 凭证(密钥和机密)。
- 如果您使用多个账户,请仔细检查 AWS 帐号。
- 运行 AWS IAM Policy Simulator 并验证输出。
我正在按照步骤在 AWS-IoT 中注册设备。我正在执行描述的步骤 by AWS to use a self-signed certificate。教程第三步指示如下命令:
aws iot get-registration-code
但我收到以下异常:
$ aws iot get-registration-code
An error occurred (AccessDeniedException) when calling the GetRegistrationCode operation: User: arn:aws:iam::xxxxxxxx:user/dalton is not authorized to perform: iot:GetRegistrationCode on resource: *
不清楚如何分配正确的权限。在 IAM 管理控制台,我为我的用户分配了以下权限:
AWSIoTThingsRegistration
AWSIoTLogging
AWSIoTConfigAccess
AWSIoTRuleActions
AWSIoTConfigReadOnlyAccess
AWSQuickSightIoTAnalyticsAccess
AWSIoTOTAUpdate
AWSIoTDataAccess
AWSIoTFullAccess
仍然没有成功。
AWSIoTFullAccess 定义此策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:*"
],
"Resource": "*"
}
]
}
因此,您将能够根据 IAM IoT policies 执行调用。附加新策略时,只需几秒钟即可在 CLI 上生效。
您需要:
- 仔细检查您的 IAM 策略并确保使用 CLI 的用户确实使用与具有 AWSIoTFullAccess 的 IAM 用户匹配的 aws 凭证(密钥和机密)。
- 如果您使用多个账户,请仔细检查 AWS 帐号。
- 运行 AWS IAM Policy Simulator 并验证输出。