# Sample Serverless.yml for multiple AWS accounts needed!

**URL:** <https://forum.serverless.com/t/sample-serverless-yml-for-multiple-aws-accounts-needed/1528>\
**Category:** Serverless Framework\
**Created:** [March 21, 2017, 8:37am UTC](https://forum.serverless.com/t/sample-serverless-yml-for-multiple-aws-accounts-needed/1528 "2017-03-21T08:37:40Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Vadorequest-SL](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/vadorequest-sl/32/1630_2.png) [@Vadorequest-SL](https://forum.serverless.com/u/Vadorequest-SL)\
**Post date:** [August 12, 2018, 7:16pm UTC](https://forum.serverless.com/t/sample-serverless-yml-for-multiple-aws-accounts-needed/1528/12 "2018-08-12T19:16:27Z")

</div>

I’ve had to read both @menocomp answer and the AWS doc to figure it out, but here is a full working example for those interested!

This setup is to configure one **profile** named `development`, which will work whether it’s executed from `aws` CLI command or `sls` CLI command. This is assuming that you want to setup a cross-account access, by providing a `role_arn` to the aws configuration.

`~/.aws/config`

```auto
[profile development]
output = json
region = eu-west-1
role_arn = your-arn
source_profile = development

```

* * *

`~/.aws/credentials`

```auto
[development]
# Necessary for both AWS CLI and SLS
aws_access_key_id = your-aws_access_key_id
aws_secret_access_key = your-aws_secret_access_key

# Necessary for SLS, because SLS doesn't do a lookup in the ./config file
role_arn = your-arn
source_profile = development

```

* * *

With this setup:

- `sls deploy --aws-profile development` will work
- `aws iam list-users --profile development` will output something similar to:

```json
{
  "Users": []
}

```

If you remove the `role_arn` and `source_profile` from `~/.aws/credentials`, you’ll notice it may still work _(depending on your permissions, doesn’t work at all in my case because my IAM user doesn’t have any permission on the root account)_, but you won’t hit the same account (you’ll hit the root account, not the cross-account)

Thanks for your input @menocomp, definitely saved me a lot of time! 🙂

---

_[View the full topic](https://forum.serverless.com/t/sample-serverless-yml-for-multiple-aws-accounts-needed/1528)._
