# Preventing cross account roles external to Organization?

**URL:** <https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881>\
**Category:** AWS Compute Discussion\
**Created:** [May 20, 2020, 8:10pm UTC](https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881 "2020-05-20T20:10:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RacePaceAce](https://awshq.com/letter_avatar_proxy/v4/letter/r/6de8d8/32.png) [@RacePaceAce](https://awshq.com/u/RacePaceAce)\
**Post date:** [May 20, 2020, 8:10pm UTC](https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881/1 "2020-05-20T20:10:27Z")

</div>

Hi All,

Currently our developers have limited access in IAM, they can create roles provided they follow a naming convention and also attach a boundary policy to the role. But how can I prevent them from creating a role that trusts a role from an account outside our organization?

It’s totally feasible that they would do a cross account role for accounts within our organization for collaboration work, but not for outside accounts.

I tried setting a deny on iam:CreateRole with the following condition, but it does not work:

“Condition”: {  
“StringNotEquals”: {  
“aws:PrincipalOrgID”: [  
“o-blahblah”  
]  
}  
},

Is this the incorrect approach? What have you guys done to secure your organization from this issue?

* * *

**Related discussions:**

- [Appstream 2.0 Rant](https://awshq.com/t/appstream-2-0-rant/7312)
- [AWS AI cloud capacity sold out through 2027, 2028 bookings filling fast](https://awshq.com/t/aws-ai-cloud-capacity-sold-out-through-2027-2028-bookings-filling-fast/21661)
- [I tested Lambda Web Functions and found ~7 minutes of idle memory billing after requests](https://awshq.com/t/i-tested-lambda-web-functions-and-found-7-minutes-of-idle-memory-billing-after-requests/21695)
- [IT Certification Support | Exam Vouchers & Booking | AWS • Azure • PMP • Cisco & More Whatsapp +91 6396163975](https://awshq.com/t/it-certification-support-exam-vouchers-booking-aws-azure-pmp-cisco-more-whatsapp-91-6396163975/21769)
- [My cost effective way of running ECS](https://awshq.com/t/my-cost-effective-way-of-running-ecs/21652)

---

<div class="post-metadata">

**Author:** ![twratl](https://awshq.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@twratl](https://awshq.com/u/twratl)\
**Post date:** [May 21, 2020, 1:31am UTC](https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881/2 "2020-05-21T01:31:25Z")

</div>

That condition will restrict non org principals from creating roles. Not really your concern I don’t think.

You are trying to restrict trust policies from trusting principals outside your org. I don’t think such conditions exist.

May need to check into a cloud compliance tool.

---

<div class="post-metadata">

**Author:** ![par\_texx](https://awshq.com/letter_avatar_proxy/v4/letter/p/74df32/32.png) [@par\_texx](https://awshq.com/u/par_texx)\
**Post date:** [May 21, 2020, 2:35am UTC](https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881/3 "2020-05-21T02:35:36Z")

</div>

Cross account roles should be fairly limited in where they come from. Ideally, they would all come out of 1 or 2 accounts, so you could just put in a deny rule if it’s not from those white listed accounts.

---

<div class="post-metadata">

**Author:** ![Munkii](https://awshq.com/letter_avatar_proxy/v4/letter/m/58956e/32.png) [@Munkii](https://awshq.com/u/Munkii)\
**Post date:** [May 21, 2020, 12:01pm UTC](https://awshq.com/t/preventing-cross-account-roles-external-to-organization/10881/4 "2020-05-21T12:01:16Z")

</div>

In a SCP you might be able to put that condition on sts:assumerole and catch things that way. Haven’t tried it, but it could work
