# Writing a rule to map a role to a user - for connecting to a cloud environment

**URL:** <https://community.auth0.com/t/writing-a-rule-to-map-a-role-to-a-user-for-connecting-to-a-cloud-environment/58069>\
**Category:** Get Help\
**Tags:** saml2\
**Created:** [February 18, 2021, 3:52am UTC](https://community.auth0.com/t/writing-a-rule-to-map-a-role-to-a-user-for-connecting-to-a-cloud-environment/58069 "2021-02-18T03:52:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![InterstellarX](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/interstellarx/32/27680_2.png) [@InterstellarX](https://community.auth0.com/u/InterstellarX)\
**Post date:** [February 18, 2021, 3:52am UTC](https://community.auth0.com/t/writing-a-rule-to-map-a-role-to-a-user-for-connecting-to-a-cloud-environment/58069/1 "2021-02-18T03:52:39Z")

</div>

Hey everyone! I’m having a hard time understanding the 5th step of “map the AWS role to a user.” (docs linked here: [https://auth0.com/docs/integrations/aws/configure-amazon-web-services-for-sso#map-aws-role-to-a-user](https://auth0.com/docs/integrations/aws/configure-amazon-web-services-for-sso#map-aws-role-to-a-user)). I’m just experimenting and I’m not sure what to make the rule do exactly. There are all of these code snippets at the bottom, but am I picking one, adding them together, etc.?

Anyone able to provide perspective of how I write the Auth0 app rule to connect to a cloud environment?

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [February 27, 2021, 11:21am UTC](https://community.auth0.com/t/writing-a-rule-to-map-a-role-to-a-user-for-connecting-to-a-cloud-environment/58069/2 "2021-02-27T11:21:55Z")

</div>

Hi @InterstellarX ,

They are examples trying to show what options you have in your implementation, ranging from the simplest use case where all users are hardcoded to the same AWS role, to dynamically setting one or multiple roles based on the user’s profile.

The last example is just showing how you could also add configuration of the session expiration, and could be combined with any of the above.

I’d recommend starting with the first, hardcoded example for your testing, and once you are happy things are working you can make additional changes to the rule to best fit your use case if needed.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 14, 2021, 11:21am UTC](https://community.auth0.com/t/writing-a-rule-to-map-a-role-to-a-user-for-connecting-to-a-cloud-environment/58069/3 "2021-03-14T11:21:58Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
