# Skipping resource from deployment

**URL:** <https://forum.serverless.com/t/skipping-resource-from-deployment/6722>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [December 14, 2018, 1:36pm UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722 "2018-12-14T13:36:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NikitaLiashenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/nikitaliashenko/32/2783_2.png) [@NikitaLiashenko](https://forum.serverless.com/u/NikitaLiashenko)\
**Post date:** [December 14, 2018, 1:36pm UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722/1 "2018-12-14T13:36:31Z")

</div>

Hi,

Let’s assume we have a part of a system which consists of two Lambdas and SNS topic in between.  
I would like to put that SNS topic in Serverless.yml file to ensure it is presented during deployment of any lambda (one Lambda write new messages, the second - consume messages).  
What will happen if I add them to both Serverless.yml files?  
Can we optionally skip creation of service during deployment?

Thanks

---

<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:** [December 18, 2018, 9:04am UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722/2 "2018-12-18T09:04:21Z")

</div>

Are you suggesting that Lambda A triggers Lambda B using SNS and that Lambda A & B are in different projects? You can allow the project with Lambda B to create the SNS topic as a trigger for Lambda B then use cross stack references to access the ARN for the SNS topic from Lambda A in the other project.

---

<div class="post-metadata">

**Author:** ![NikitaLiashenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/nikitaliashenko/32/2783_2.png) [@NikitaLiashenko](https://forum.serverless.com/u/NikitaLiashenko)\
**Post date:** [December 18, 2018, 9:07am UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722/3 "2018-12-18T09:07:16Z")

</div>

Yeah, let’s assume these are different services.  
The idea is to put all useful resources in Serverless.yml for every Lambda and if we have some shared resource it’s not clear what should we do.  
I want to deploy Lambda A if SNS exists and deploy Lambda B if SNS exists, so I need to check it’s existance during both deployments.

---

<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:** [December 18, 2018, 9:24am UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722/4 "2018-12-18T09:24:29Z")

</div>

What you want is a [cross stack reference](https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-cloudformation-outputs). You need to create the SNS topic in one project (stack) then import the ARN for it into the others. If you use the `${cf:stack.output}` variable syntax then Serverless will warn you during deployment that it cannot resolve the cross stack reference if it doesn’t exist.

I would generally recommend creating the SNS topic in the stack that publishes the message (which is the opposite of what I described above). While it’s a little more difficult than allowing Serverless to automatically create the topic it makes more sense if you ever end up using fan out (i.e. publishing a message to an SNS topic triggers multiple Lambda in different stacks).

---

<div class="post-metadata">

**Author:** ![NikitaLiashenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/nikitaliashenko/32/2783_2.png) [@NikitaLiashenko](https://forum.serverless.com/u/NikitaLiashenko)\
**Post date:** [December 18, 2018, 9:39am UTC](https://forum.serverless.com/t/skipping-resource-from-deployment/6722/5 "2018-12-18T09:39:15Z")

</div>

Looks interesting.  
Will check it, thanks,
