Skip to content

solve-hq/aws-sam-helper-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-sam-helper-commands

A CLI tool to make certain common AWS SAM commands easier to use

oclif Version Downloads/week License

Commands

Deploy

Deploys a SAM stack to AWS using the stack definition in stack-config.json.

To use, first create a stack-config.json file in the root of your repository, e.g.:

{
  "namespace": "Services",
  "service": "FeedApi",
  "name": "feed-api",
  "capabilities": ["CAPABILITY_IAM"],
  "stages": {
    "dev": {
      "profile": "dev",
      "regions": {
        "eu-west-2": {
          "bucket": "solve-dev-source-code-eu-west-2"
        }
      }
    }
  },
  "secrets": {
    "FeatureFlagService": {
      "token": "api-1234",
      "projectKey": "app"
    }
  }
}

Note As you can see above, this file may contain secrets. For that reason, make sure to add stack-config.json to your .gitignore file to avoid publishing the file to a remote repo.

Then, to deploy, run deploy and pass in the stage name and the region to deploy to:

$ npx sam-helper deploy --stage dev --region eu-west-2

The above command will deploy a stack named feed-api-dev and will make sure the /Services/FeedApi/FeatureFlagService secret exists, if not it will be created.

You can skip running sam build by passing the skip-build flag:

$ npx sam-helper deploy --stage dev --region eu-west-2 --skip-build