2017-01-25 14 views
2

私はステップ関数を作成しましたが、私はHTTPリクエストを使用してそれを呼び出そうとしています。私は認証署名を生成するためにPostmanを使用していますが、私は403:禁止された応答を得ています。HTTPリクエストを使用してawsステップ関数を呼び出す方法は?

<InvalidSignatureException> 
    <Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. 

I am invoking https://states.ap-northeast-1.amazonaws.com and getting back the reponse 

The Canonical String for this request should have been 
'POST 
/

content-length:116 
content-type:application/x-www-form-urlencoded 
host:states.ap-northeast-1.amazonaws.com 
x-amz-date:20170125T183745Z 

content-length;content-type;host;x-amz-date 
488183a388ce9b63833585129e71399296c8aa0ce4108b8f90d9616c43969a97' 

The String-to-Sign should have been 
'AWS4-HMAC-SHA256 
20170125T183745Z 
20170125/ap-northeast-1/states/aws4_request 
fb2e325f309bf455dddbc0cd389523a9aa2410523393c9dc3890dac6e93e923c' 
</Message> 
</InvalidSignatureException> 

私はステップ機能を呼び出す権限がないようです。しかし、ポリシーファイルでは、特定の役割のユーザーにアクセス権を付与しました。

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
    { 
     "Effect": "Allow", 
     "Principal": { 
     "AWS": "arn:aws:iam::7640*******:user/*****", 
     "Service": "states.ap-northeast-1.amazonaws.com" 
     }, 
     "Action": "sts:AssumeRole" 
    } 
    ] 
} 

これを設定してもらえますか?

+0

あなたがhttpsに 'POST'リクエストを送信することにより、直接、状態マシンを起動しようとしています-1.amazonaws.com?その場合は、AWS SDKを使用して状態マシンを起動する必要があります。たとえば、[startExecutionメソッド](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#startExecution-property)を使用したNodeJSを使用します。 –

答えて

0

ポリシーにはsts:AssumeRole件のステートメントがありますが、sts APIは呼び出していませんでしたか? states APIを呼び出しても、ポリシーに対応するステートメントはありません。

sts:AssumeRoleステートメントを削除します。 次のステートメントを追加してください。

Effect: Allow 
Action: states:StartExecution 
Resource: ARN of your state machine 
関連する問題