Error with creating Cloudformation stack during creating resources and have a role specified

0

I am exploring how to delegate Cloudformation permission to other users by testing specifying a role when creating a stack. I notice that some resources like VPC, IGW and EIP can be created but error was prompted. The created resources cannot be deleted by the stack also during rollback or stack deletion.

For example, the following simple template create a VPC:

Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 10.3.9.0/24

I have actually created a role to specify during creation with policy which allow a lot of actions that I collected by querying the cloudtrail using athena. The following are already included: "ec2:CreateVpc","ec2:DeleteVpc","ec2:ModifyVpcAttribute" However, the following occur during creation:

Resource handler returned message: "You are not authorized to perform this operation. (Service: Ec2, Status Code: 403, Request ID: bf28db5b-461e-48ff-9430-91cc05be77ef)" (RequestToken: bc6c6c87-a616-2e94-65eb-d4e5488a499a, HandlerErrorCode: AccessDenied)

Looks like some callback mechanisms are used? The VPC was actually created. The deletion was also failed but it did not succeeded.

Resource handler returned message: "You are not authorized to perform this operation. (Service: Ec2, Status Code: 403, Request ID: f1e43bf1-eb08-462a-9788-f183db2683ab)" (RequestToken: 80cc5412-ba28-772b-396e-37b12dbf8066, HandlerErrorCode: AccessDenied)

Any hint about this issue? Thanks.

Alan
已提問 2 年前檢視次數 1423 次
2 個答案
2
已接受的答案

To diagnose the issue my advice is to use cloudtrail and find the calls cloudformation is making and subsequently being denied - cloudtrail will reveal the full detail of what is being denied

I'll also add you may want to have a look at service catalog and launch constraints as a way of allowing "other" users to provision an approved product. There is more control over the template used and ability to share across an organization. There is a workshop to demo the features

AWS
專家
Peter_G
已回答 2 年前
profile picture
專家
已審閱 5 天前
  • Thanks. Actually I did try to find corresponding cloudtrail log but could not really figure out what were denied even with this very simple example. There are not really many logs and so I am not sure whether I miss something else.

    Also thanks for the suggestion about service catalog. Will take a look at the workshop.

    PS Notice that it is easier to search the cloudtrail using the corresponding requestid. Will try to fix the policy based on the error.

0

I think you need to add ec2::DescribeVpcs to get a more descriptive error

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南