---
title: "Comment by Chris Nagy on \"Build & deploy all AWS resources as easy as: npm run deploy-prod (AWS Sam worflow)\" | Hashnode"
description: "I always wondered about the benefits of using a bash script for deployments vs using sam deploy lets say. Can you elaborate on the pros of using a seperate bash"
url: "https://hashnode.com/posts/build-and-deploy-all-aws-resources-as-easy-as-npm-run-deploy-prod-aws-sam-worflow/5ef2756e2fb6648468ee0f57/comment/5f25ed43669da9610ee18110"
---

[Discussion](https://hashnode.com/posts/build-and-deploy-all-aws-resources-as-easy-as-npm-run-deploy-prod-aws-sam-worflow/5ef2756e2fb6648468ee0f57)

Comment [Build & deploy all AWS resources as easy as: npm run deploy-prod (AWS Sam worflow)](https://hashnode.com/posts/build-and-deploy-all-aws-resources-as-easy-as-npm-run-deploy-prod-aws-sam-worflow/5ef2756e2fb6648468ee0f57)

[Chris Nagy](https://hashnode.com/@chris_the_nagy)

[Aug 1, 2020](https://hashnode.com/posts/build-and-deploy-all-aws-resources-as-easy-as-npm-run-deploy-prod-aws-sam-worflow/5ef2756e2fb6648468ee0f57/comment/5f25ed43669da9610ee18110)

I always wondered about the benefits of using a bash script for deployments vs using `sam deploy` lets say. Can you elaborate on the pros of using a seperate bash script? Since `sam build && sam deploy` is so easy to use now😅

[Mirko Vukušić](https://hashnode.com/@psiho)

[Aug 2, 2020](https://hashnode.com/posts/build-and-deploy-all-aws-resources-as-easy-as-npm-run-deploy-prod-aws-sam-worflow/5ef2756e2fb6648468ee0f57/comment/5f25ed43669da9610ee18110#reply-5f260a6d669da9610ee18193)

Well, bash script actually uses sam-build and sam-deploy if you look at it. However, it does a few other things too. Mostly, I used json-refs to be able to split template into smaller (managable) files AND also optimize yaml for API Gateway's DefinitionBody. $ref there can only be used ina few places and with json-refs I can use it anywhere, making my definition body really small and easy to write/extend. Second reason is to make it easier to include AWS build/deploy into main build/deploy script that runs the same for both frontend (Webpack) and backend (AWS). And all that for different stages. It seemed much cleaner to separate the two instead of using sam-build in main build script.
