Skip to content

AWS/ Serverless Fixing AccessDeniedException

Programming · June 2, 2016

Sharing is Caring

“Unhandled rejection AccessDeniedException: Your access has been denied by EC2, please make sure your function execution role have permission to CreateNetworkInterface. EC2 Error Code: UnauthorizedOperation. EC2 Error Message: You are not authorized to perform this operation.”

That’s a pretty annoying error to receive when deploying from Serverless to AWS, but the fix is really pretty simple.

Add following role policy to the functions role:

{
  "Effect": "Allow",
  "Action": [
    "ec2:CreateNetworkInterface",
    "ec2:DescribeNetworkInterfaces",
    "ec2:DeleteNetworkInterface"
  ],
  "Resource": "*"
}
Sharing is Caring
AccessDeniedException AWS CreateNetworkInterface Serverless