2017-08-03 2 views
0

Ich versuche, AWS SNS mit SSM zu verwenden, aber einen Fehler über Rollen zu erhalten.Fehler bei der Verwendung von EC2 SNS mit SSM (Systems Manager)

Hier ist der Fehler:

botocore.errorfactory.InvalidRole: An error occurred (InvalidRole) when calling the SendCommand operation: ServiceRoleArn is not valid: arn:aws:iam::<account #>:role/FullSNS 

Hier ist der entsprechende Code:

response = client.send_command(
InstanceIds=[ 
    '<instance id>', 
], 
DocumentName='AWS-RunShellScript', 
Parameters={ 
    'commands': [ 
     '<command>', 
    ], 
    'workingDirectory': [ 
     '<directory>' 
    ] 
}, 
OutputS3BucketName='<s3 bucket>', 
ServiceRoleArn='arn:aws:iam::<account #>:role/FullSNS', 
NotificationConfig={ 
    'NotificationArn': 'arn:aws:sns:us-east-1:<account #>:MyTestTopic', 
    'NotificationEvents': [ 
     'All', 
     ], 
    'NotificationType': 'Command' 
    } 
) 

Und hier ist die Politik auf diese Rolle:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
{ 
    "Action": [ 
    "sns:*" 
    ], 
    "Effect": "Allow", 
    "Resource": "*" 
} 
] 
} 

Die oben mit boto3, aber ich der gleiche Fehler, wenn ich es in der Konsole versuche.

Antwort

2

Ich wünsche die AWS Dokumentation klarer zu diesem Punkt war, aber ich hatte auch die Vertrauensbeziehung auf dieser IAM Rolle zu bearbeiten wie folgt aussehen:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
    { 
     "Effect": "Allow", 
     "Principal": { 
     "Service": "ssm.amazonaws.com" 
     }, 
     "Action": "sts:AssumeRole" 
    } 
    ] 
} 
Verwandte Themen