# How to set user?

**URL:** <https://forum.serverless.com/t/how-to-set-user/5354>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [August 6, 2018, 2:14am UTC](https://forum.serverless.com/t/how-to-set-user/5354 "2018-08-06T02:14:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![infinitedreams9586](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/infinitedreams9586/32/2362_2.png) [@infinitedreams9586](https://forum.serverless.com/u/infinitedreams9586)\
**Post date:** [August 6, 2018, 2:14am UTC](https://forum.serverless.com/t/how-to-set-user/5354/1 "2018-08-06T02:14:33Z")

</div>

I created a user, assigned admin access and configured key in my local, but when I run sls deploy command I am getting error.

ServerlessError: User: arn:aws:iam::660841947412:user/vagrant is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:us-east-1:660841947412:stack/simple-dev/\*

I don’t know why I am getting the error because the key, and secret I set has admin access. And why user name is user/vagrant, because the user associated with key, and secret has different name on aws. how do I change it ?

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [August 8, 2018, 12:25am UTC](https://forum.serverless.com/t/how-to-set-user/5354/2 "2018-08-08T00:25:29Z")

</div>

It sounds like Serverless isn’t using the user you expect for deployments. How are you telling Serverless which user to use for deployments?

---

<div class="post-metadata">

**Author:** ![infinitedreams9586](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/infinitedreams9586/32/2362_2.png) [@infinitedreams9586](https://forum.serverless.com/u/infinitedreams9586)\
**Post date:** [August 8, 2018, 12:40am UTC](https://forum.serverless.com/t/how-to-set-user/5354/3 "2018-08-08T00:40:13Z")

</div>

I set aws credentials in credentials file as per serverless documentation.  
and then running sls deploy command.  
I am begineer with serverless, I don’t know how to specify user during deployment. I believe it is using credentails set but user name is not correct. How do I set that ?

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [August 8, 2018, 12:49am UTC](https://forum.serverless.com/t/how-to-set-user/5354/4 "2018-08-08T00:49:19Z")

</div>

Can I assume this means you’re setting the `default` profile then running `sls deploy` without specifying a profile on the command line or setting `profile` inside your `serverless.yml`? The Serverless Framework uses the AWS SDK and it’s mechanism for selecting which profile to use unless you specify it. The chances are it’s being overridden by an environment variable somewhere. Trying renaming the profile in your credentials file then deploy using

```auto
sls deploy --aws-profile YOUR_PROFILE_NAME

```

---

<div class="post-metadata">

**Author:** ![infinitedreams9586](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/infinitedreams9586/32/2362_2.png) [@infinitedreams9586](https://forum.serverless.com/u/infinitedreams9586)\
**Post date:** [August 8, 2018, 1:07am UTC](https://forum.serverless.com/t/how-to-set-user/5354/5 "2018-08-08T01:07:14Z")

</div>

Hi buggy,

Thank you very much for your quick response. Yes, I have set only one profile which is default one. I’ll try your suggestion. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![infinitedreams9586](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/infinitedreams9586/32/2362_2.png) [@infinitedreams9586](https://forum.serverless.com/u/infinitedreams9586)\
**Post date:** [August 9, 2018, 8:44am UTC](https://forum.serverless.com/t/how-to-set-user/5354/6 "2018-08-09T08:44:31Z")

</div>

mentioning profile name explicitly worked “sls deploy --aws-profile default”. But don’t know why it is not used without mentioning it. Thanks @buggy

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [August 9, 2018, 11:13pm UTC](https://forum.serverless.com/t/how-to-set-user/5354/7 "2018-08-09T23:13:18Z")

</div>

If you don’t explicitly set the profile then the AWS SDK has a process for determining which one to use. If you want to understand more then read the [AWS Guide](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).

My best guess is you’re setting the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables somewhere.

---

<div class="post-metadata">

**Author:** ![infinitedreams9586](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/infinitedreams9586/32/2362_2.png) [@infinitedreams9586](https://forum.serverless.com/u/infinitedreams9586)\
**Post date:** [August 10, 2018, 12:47am UTC](https://forum.serverless.com/t/how-to-set-user/5354/8 "2018-08-10T00:47:45Z")

</div>

Thanks buggy. Yes, that was the case, I forgot that I had set key and secret in env var for an another project. 🙂
