# Need suggestions: How to have a production and development stages by using a single account?

**URL:** <https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985>\
**Category:** Serverless Framework\
**Tags:** api-gateway\
**Created:** [January 12, 2019, 2:11pm UTC](https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985 "2019-01-12T14:11:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![md\_shah](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@md\_shah](https://forum.serverless.com/u/md_shah)\
**Post date:** [January 12, 2019, 2:11pm UTC](https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985/1 "2019-01-12T14:11:18Z")

</div>

I was thinking about using multiple stages like production and development using a single account. And how can i do that? “sls deploy --stage prod”. Is this proper way of implementing stages??

---

<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:** [January 12, 2019, 11:55pm UTC](https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985/2 "2019-01-12T23:55:04Z")

</div>

That will work. Some resource, like DynamoDB, require a different name for each stage. To do that I like to set the `region` and `stage` in my `provider`:

```auto
provider:
  region: ${opt:region, "us-east-1"}
  stage: ${opt:stage, "dev"}

```

I can then add `-${self:provider.stage}` to resource names so AWS creates different resources for each stage.

---

<div class="post-metadata">

**Author:** ![md\_shah](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@md\_shah](https://forum.serverless.com/u/md_shah)\
**Post date:** [January 13, 2019, 1:04am UTC](https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985/3 "2019-01-13T01:04:04Z")

</div>

Hi, Thanks for your reply. What I was thinking is, How can I do it dynamically? Without providing the data inside the serverless.yml file ? Is there any issue with that approach ?

---

<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:** [January 14, 2019, 10:55am UTC](https://forum.serverless.com/t/need-suggestions-how-to-have-a-production-and-development-stages-by-using-a-single-account/6985/4 "2019-01-14T10:55:35Z")

</div>

That is how you do it dynamically. Here’s a more complete example:

```auto
service:
  name: my-service

provider:
  name: aws
  runtime: nodejs8.10
  stage: ${opt:stage, "dev"}
  region: ${opt:region, "us-east-1"}

custom:
  myTableName: my-table-${self:provider.stage}

functions:
  helloWorld:
    handler: handler.helloWorld
    environment:
      TABLE_NAME: ${self:custom.myTableName}

resources:
  Resources:
    MyTable:
      Type: AWS::DynamoDB::Table
      Properties:
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        BillingMode: PAY_PER_REQUEST
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        TableName: ${self:custom.myTableName}

```

You can now `sls deploy --stage ANY_ENVIRONMENT` and it will set up the complete environment including tables.
