# Serverless is not able to create IAM role and lambda function after deleting them

**URL:** <https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [March 18, 2017, 6:19am UTC](https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505 "2017-03-18T06:19:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![murali129](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@murali129](https://forum.serverless.com/u/murali129)\
**Post date:** [March 18, 2017, 6:19am UTC](https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505/1 "2017-03-18T06:19:43Z")

</div>

I have deployed a lambda function using serverless which created a IAM role and lambda function for me, I manually deleted them from my aws console, when try to redeploy again using serverless, it is throwing an error

Serverless Error ---------------------------------------

```
 An error occurred while provisioning your stack: HelloLambdaFunction
 - Template error: IAM role aws-nodejs-dev-us-east-1-lambdaRole
 doesn't exist.

```

I dont know if this is a bug or something, so posted here instead of creating a github issue

---

<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:** [March 19, 2017, 1:11am UTC](https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505/2 "2017-03-19T01:11:56Z")

</div>

If you manually delete resources then Cloud Formation won’t re-create them for you. You generally have three options available.

1. Manually re-create the resource. This only works for resource identified by name which I think includes IAM.
2. Remove all references to the resource then deploy. Add the resource back then deploy again. I’ve used this to fix accidentally deleted DynamoDB tables.
3. Use `sls remove` to completely remove the application and deploy a new copy.

---

<div class="post-metadata">

**Author:** ![murali129](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@murali129](https://forum.serverless.com/u/murali129)\
**Post date:** [March 19, 2017, 5:05am UTC](https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505/3 "2017-03-19T05:05:54Z")

</div>

Thanks, I followed I first one

---

<div class="post-metadata">

**Author:** ![bright](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bright](https://forum.serverless.com/u/bright)\
**Post date:** [February 21, 2019, 10:05am UTC](https://forum.serverless.com/t/serverless-is-not-able-to-create-iam-role-and-lambda-function-after-deleting-them/1505/4 "2019-02-21T10:05:36Z")

</div>

@buggy I followed the 3rd options it works. Thanks
