Attach an existing policy to an existing role in CloudFormation

0

How can a CloudFormation template attach an existing Policy to an existing Role?

From what I see we can:

...but seems like maybe you'd need to resort to a custom resource for the case where both already exist?

For my use case, a solution with either Inline or Managed policies would be fine.

1개 답변
0
수락된 답변

This is not possible in CloudFormation today as there is no such resource. Also, if we consider CloudFormation had a resource to do this, it would just be a logical resource that attaches a policy to a role, just like how we have route to route table attachment. So your options are

  1. Use custom resource or
  2. Create a new role and attach an existing policy to it or
  3. Create a new policy and attach it to an existing role or
  4. Create both in CloudFormation
AWS
답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠