A command line tool, supports AWS serverless application development.
- Create AWS serverless project template (TypeScript, node).
 - Manage parameters by AWS Systems Manager parameter store.
 - Deploy Lambda Function using AWS SAM.
 - Deploy AWS resources using AWS CloudFormation.
 
npm i -g tsastsas -h
---
Usage: tsas COMMAND
Commands:
  tsas init     Create a new, empty Typed Lambda project from a template.
  tsas param    Manage application parameters, [push|list]
  tsas deploy   Deploy aws resources, [serverless|sls|cloudformation|cfn]
  tsas display  Display information [cfn-parameters]
Options:
  --version   Show version number                                      [boolean]
  --region    Use the indicated AWS region to override default in config file.
                                                                        [string]
  --env, -e   Environment name; such as dev, stg, prod...               [string]
  --verbose   Set verbose mode.                       [boolean] [default: false]
  -h, --help  Show help                                                [boolean]AWS accessible CLI. See:
If you need to switch role, you can use these helpful tools.
- tilfin/homebrew-aws: AWS commands easy to manipulate on terminal
 - waddyu/aws_swrole: Switch AWS IAM Roles and start new session.
 
mkdir hello-world
cd hello-world
tsas initenvironments/${env}/parameters.json has application parameters. This tool uses parameter store for CloudFormation deploy, so you should push local parameters to aws, at first.
tsas param push --env stg
tsas param list --env stgtsas deploy serverless --env stg tsas deploy cloudformation dynamodb --env stg Using aws/aws-cli: Universal Command Line Interface for Amazon Web Services.
aws lambda invoke --function-name <your-function-name> --log-type Tail \
--payload '{"name":"Bob"}' \
outputfile.txtDynamoDB table greeting will have been updated.
- Manage parameters used in the whole application with a parameter store.
 - Deploy Lambda Function using AWS SAM.
 - Deploy AWS resources using CloudFormation.
 
As you see, within this tool, you do not need to include the Parameters section in your SAM or CloudFormation templates.
environments/${env}/parameters.json has application parameters. If you want to add/modify parameters, edit the json file and re-push to parameter store, using:
tsas param push --env stgIf you want to confirm CloudFormation Parameter section, use:
tsas display cfn-parameters --env stgIf you don't want to write paramter to variables.json, use this command.
tsas param put <key> <value>
tsas param put AccessKey LFIOPWEPJSD23423ALGFJ --env stg
tsas param put AccessSecret afasdgbaj==awefaebasdvmkls--__ --env stgThere are 3 steps.
- Add TypeScript source code.
 - Append entry to 
webpack.config.js. - Append the function information to 
lambda.yaml. 
src/handlers has lambda function entry point. So, you can start developing new functions by adding files to handlers.
After that, edit webpack.config.js to entry new function.
...
module.exports = {
    mode: 'development',
    target: 'node',
    entry: {
       'hello-world': path.resolve(__dirname, './src/lambda/handlers/api-gw/api-gw-greeting.ts'),
        // add ( example )
        'next-step': path.resolve(__dirname, './src/lambda/handlers/api-gw/api-gw-next-step.ts'), 
    }
...    Finally, edit templates/lambda.yaml.
Resources:
  HelloWorldHelloLambda:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub ${Env}-${AppName}-hello
      Role: !GetAtt HelloWorldLambdaRole.Arn
      Handler: hello-world/index.handler
      Runtime: nodejs8.10
      CodeUri:
        Bucket: !Ref DeployBucketName
        Key: !Sub ${ChangeSetHash}/dist.zip
      Timeout: 5
      Environment:
        Variables:
          ENV: !Ref Env
          GREETING_TABLE_NAME: !Ref GreetingTableName
          REGION: !Ref AWS::Region
            
  HelloWorldNextStepLambda: # Add
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub ${Env}-${AppName}-next-step
      Role: !GetAtt HelloWorldLambdaRole.Arn
      Handler: next-step/index.handler
      Runtime: nodejs8.10
      CodeUri:
        Bucket: !Ref DeployBucketName
        Key: !Sub ${ChangeSetHash}/dist.zip
      Timeout: 5
      Environment:
        Variables:
          ENV: !Ref Env
          REGION: !Ref AWS::Region- Add CloudFormation template file or append to exists.
 - Deploy with a name.
 
tsas deploy cloudformation <template_name> needs target template name, such as:
tsas deploy cloudformation dynamodb --env stgThe <template_name> is required to match the CloudFormation template file name, so above command will deploy templates/dynamodb.yaml.
You can add new resources by following steps.
touch templates/s3.yaml
### edit file ###
tsas deploy cloudformation s3 --env stgInitial templates only refers to the stg environment. You can define ather environments.
Even in different environments, above flow is the same.
You only need to create a new environment setting file.
touch environments/prd/variables.json
### edit json file ###After that, adjust --env option.
tsas param push --env prd
tsas deploy serverless --env prd 
tsas deploy cloudformation dynamodb --env prd