aws ssm create\ U激活api使用regex失败

2024-04-25 19:55:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用boto3api调用激活ssm管理器上的AWS ec2实例,但是由于regex错误而失败。你知道吗

问题已在https://github.com/aws/aws-sdk-js/issues/2748提出,但找不到合适的解决方案

response = client.create_activation(DefaultInstanceName='my-instance-name', 
                                   IamRole='arn:aws:iam::xxxxxxx:role/my-role-name')

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 623, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the CreateActivation operation: 1 validation error detected: Value 'arn:aws:iam::xxxxxxxx:role/my-role-name' at 'iamRole' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[\p{L}\p{N}+=,.@-_/]*$

虽然我模仿了我的角色阿恩。你知道吗

如果有人能解决这个问题,我真的很感激。。你知道吗


Tags: nameinclientawsapiresponsemyline
1条回答
网友
1楼 · 发布于 2024-04-25 19:55:18

IamRole参数需要角色的名称,而不是ARN。应该用my-role-name替换arn:aws:iam::xxxxxxx:role/my-role-name。你知道吗

response = client.create_activation(DefaultInstanceName='my-instance-name',
                                    IamRole='my-role-name')

相关问题 更多 >

    热门问题