2017-07-01 15 views
0

私のラムダ関数にvpcアクセスを許可したい。私は次のaws cliコマンドを使用します。私は、ラムダの役割とAWSコマンドを実行するユーザの両方に次の権限を付与しているaws lambda update-function-configurationがAccessDeniedExceptionを受け取る

An error occurred (AccessDeniedException) when calling the UpdateFunctionConfiguration operation: Your access has been denied by EC2, please make sure your request credentials have permission to DescribeSecurityGroups for sg-xxxx. EC2 Error Code: UnauthorizedOperation. EC2 Error Message: You are not authorized to perform this operation.

aws lambda update-function-configuration \ 
--function-name SampleFunction \ 
--vpc-config SubnetIds=subnet-xxxx,SecurityGroupIds=sg-xxxx 

は、しかし、私は、次のエラーメッセージが表示されます。

- "ec2:CreateNetworkInterface" 
    - "ec2:DescribeNetworkInterfaces" 
    - "ec2:DeleteNetworkInterface" 
    - "ec2:DescribeSecurityGroups" 

さらに、ラムダの役割とユーザーの両方にフルアクセスを許可しようとしました。しかし、それでも同じエラーが発生しました

他に何を試すことができますか?

+0

EC2-Instanceから実行しようとしていますか?その場合は、インスタンスプロファイルに適切な権限が必要です。 – MaiKaY

答えて

0

ユーザーIAMポリシーにはさらにアクセス許可が必要です。

たとえば、ec2:CreateSecurityGroup &などを参照してください。thisのドキュメントを参照して、必要なアクセス許可を追加してください。