Create an SST app

Link to chapter — https://serverless-stack.com/chapters/create-an-sst-app.html

Hello,

When I run the following command to create an SST app:

$ npx create-serverless-stack@latest notes
$ cd notes

The sst.json file looks different than what is shown in the page.

This is what the page shows:

{
  "name": "notes",
  "stage": "dev",
  "region": "us-east-1",
  "lint": true
}

And this is the sst.json that was created:

{
  "name": "notes",
  "region": "us-east-1",
  "main": "stacks/index.js"
}

I edited sst.json as follows:

{
      "name": "notes",
      "stage": "dev",
      "region": "eu-central-1",
      "main": "stacks/index.js"
}

And then I ran npx sst start. When I navigate to the CloudFormation Console, I see that there are two stacks created:

  1. dev-notes-my-stack
  2. dev-notes-debug-stack

Is this the expected behavior? It seems like from the guide, and the command name itself (i.e.start) that it should only start locally, but not actually deploy.

I’m also confused as to why it created to stacks instead of just one.

Here is the CloudFormation console showing the created stacks after running npx sst start:


Here’s the terminal output after running npx sst start, and visiting the endpoint once:
(P.S I substituted my actual account ID with accountID)

Warning: Setting the stage in the "sst.json" will be deprecated soon. Read more about this change here: https://docs.serverless-stack.com/working-locally#deprecating-the-stage-option-in-the-sstjson
Using stage: dev
Preparing your SST app
Transpiling source
Linting source

=======================
 Deploying debug stack
=======================

Deploying stacks
CDK_NEW_BOOTSTRAP set, using new-style bootstrapping
 ⏳  Bootstrapping environment aws://accountID/eu-central-1...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...










 ✅  Environment aws://accountID/eu-central-1 bootstrapped.
Checking deploy status...
Checking deploy status...
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::CloudFormation::Stack | dev-notes-debug-stack
Checking deploy status...
Checking deploy status...
Checking deploy status...
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Api | Api
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ServiceRole4288B192
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::DynamoDB::Table | TableCD117FA1
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::S3::Bucket | Bucket83908E77
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::DynamoDB::Table | TableCD117FA1
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ServiceRole4288B192
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | DisconnectServiceRole90AEC2EB
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ConnectServiceRole07B61CE8
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | DisconnectServiceRole90AEC2EB
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::S3::Bucket | Bucket83908E77
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ConnectServiceRole07B61CE8
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Api | Api
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Api | Api
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Stage | ApiStage
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Stage | ApiStage
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Stage | ApiStage
Checking deploy status...
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Role | ServiceRole4288B192
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Role | CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Role | DisconnectServiceRole90AEC2EB
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Role | ConnectServiceRole07B61CE8
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ServiceRoleDefaultPolicy94CF55F6
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | DisconnectServiceRoleDefaultPolicy32856207
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ConnectServiceRoleDefaultPolicyCE008EDB
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ServiceRoleDefaultPolicy94CF55F6
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | DisconnectServiceRoleDefaultPolicy32856207
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ConnectServiceRoleDefaultPolicyCE008EDB
dev-notes-debug-stack | CREATE_COMPLETE | AWS::S3::Bucket | Bucket83908E77
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::S3::BucketPolicy | BucketPolicyE9A3008A
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::S3::BucketPolicy | BucketPolicyE9A3008A
dev-notes-debug-stack | CREATE_COMPLETE | AWS::S3::BucketPolicy | BucketPolicyE9A3008A
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Function | CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F
dev-notes-debug-stack | CREATE_IN_PROGRESS | Custom::S3AutoDeleteObjects | BucketAutoDeleteObjectsCustomResourceBAFD23C2
dev-notes-debug-stack | CREATE_COMPLETE | AWS::DynamoDB::Table | TableCD117FA1
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Policy | ServiceRoleDefaultPolicy94CF55F6
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Policy | DisconnectServiceRoleDefaultPolicy32856207
dev-notes-debug-stack | CREATE_COMPLETE | AWS::IAM::Policy | ConnectServiceRoleDefaultPolicyCE008EDB
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Resource
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Disconnect7D6B12BD
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Connect5B7625CA
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Resource
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Function | Resource
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Disconnect7D6B12BD
dev-notes-debug-stack | CREATE_IN_PROGRESS | Custom::S3AutoDeleteObjects | BucketAutoDeleteObjectsCustomResourceBAFD23C2
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | Connect5B7625CA
dev-notes-debug-stack | CREATE_COMPLETE | Custom::S3AutoDeleteObjects | BucketAutoDeleteObjectsCustomResourceBAFD23C2
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Function | Disconnect7D6B12BD
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Function | Connect5B7625CA
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | DefaultIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | DefaultPermission
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | DefaultPermission
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | DefaultIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | ConnectIntegration
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Integration | DefaultIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | DisconnectIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | DisconnectDisconnectPermission933E876E
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | ConnectConnectPermission9DBC7813
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | ConnectConnectPermission9DBC7813
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | DisconnectDisconnectPermission933E876E
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | ConnectIntegration
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Integration | ConnectIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | DisconnectIntegration
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Integration | DisconnectIntegration
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | DefaultRoute
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | ConnectRoute
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | DefaultRoute
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Route | DefaultRoute
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | DisconnectRoute
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | DisconnectRoute
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Route | DisconnectRoute
dev-notes-debug-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | ConnectRoute
dev-notes-debug-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Route | ConnectRoute
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Permission | DefaultPermission
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Permission | ConnectConnectPermission9DBC7813
dev-notes-debug-stack | CREATE_COMPLETE | AWS::Lambda::Permission | DisconnectDisconnectPermission933E876E
dev-notes-debug-stack | CREATE_COMPLETE | AWS::CloudFormation::Stack | dev-notes-debug-stack

 ✅  dev-notes-debug-stack


Stack dev-notes-debug-stack
  Status: deployed
  Outputs:
    BucketArn: arn:aws:s3:::dev-notes-debug-stack-bucket83908e77-1u31iqt4zzmwn
    BucketName: dev-notes-debug-stack-bucket83908e77-1u31iqt4zzmwn
    Endpoint: wss://cpzercu4sd.execute-api.eu-central-1.amazonaws.com/dev


===============
 Deploying app
===============

Deploying stacks
Checking deploy status...
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::CloudFormation::Stack | dev-notes-my-stack
Checking deploy status...
Checking deploy status...
Checking deploy status...
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ApiLambdaGETServiceRole210B6205
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::CDK::Metadata | SSTMetadata
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Api | ApiCD79AAA0
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::IAM::Role | ApiLambdaGETServiceRole210B6205
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::CDK::Metadata | SSTMetadata
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Api | ApiCD79AAA0
dev-notes-my-stack | CREATE_COMPLETE | AWS::CDK::Metadata | SSTMetadata
dev-notes-my-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Api | ApiCD79AAA0
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Logs::LogGroup | ApiLogGroup1717FE17
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Logs::LogGroup | ApiLogGroup1717FE17
dev-notes-my-stack | CREATE_COMPLETE | AWS::Logs::LogGroup | ApiLogGroup1717FE17
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Stage | ApiDefaultStage1AAE989B
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Stage | ApiDefaultStage1AAE989B
dev-notes-my-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Stage | ApiDefaultStage1AAE989B
Checking deploy status...
dev-notes-my-stack | CREATE_COMPLETE | AWS::IAM::Role | ApiLambdaGETServiceRole210B6205
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ApiLambdaGETServiceRoleDefaultPolicy013A8DEA
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::IAM::Policy | ApiLambdaGETServiceRoleDefaultPolicy013A8DEA
Checking deploy status...
dev-notes-my-stack | CREATE_COMPLETE | AWS::IAM::Policy | ApiLambdaGETServiceRoleDefaultPolicy013A8DEA
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | ApiLambdaGETB1714EF3
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::Function | ApiLambdaGETB1714EF3
dev-notes-my-stack | CREATE_COMPLETE | AWS::Lambda::Function | ApiLambdaGETB1714EF3
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::EventInvokeConfig | ApiLambdaGETEventInvokeConfig1B7345F6
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | ApiRouteGETdevnotesmystackApiRouteGET21006C5EPermissionA482583E
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | ApiRouteGETHttpIntegration21fa5f74f1a9ce06757310bdc473058a6E5ECB5F
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::Permission | ApiRouteGETdevnotesmystackApiRouteGET21006C5EPermissionA482583E
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Integration | ApiRouteGETHttpIntegration21fa5f74f1a9ce06757310bdc473058a6E5ECB5F
dev-notes-my-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Integration | ApiRouteGETHttpIntegration21fa5f74f1a9ce06757310bdc473058a6E5ECB5F
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::Lambda::EventInvokeConfig | ApiLambdaGETEventInvokeConfig1B7345F6
dev-notes-my-stack | CREATE_COMPLETE | AWS::Lambda::EventInvokeConfig | ApiLambdaGETEventInvokeConfig1B7345F6
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | ApiRouteGET8AC7D3F8
dev-notes-my-stack | CREATE_IN_PROGRESS | AWS::ApiGatewayV2::Route | ApiRouteGET8AC7D3F8
dev-notes-my-stack | CREATE_COMPLETE | AWS::ApiGatewayV2::Route | ApiRouteGET8AC7D3F8
Checking deploy status...
dev-notes-my-stack | CREATE_COMPLETE | AWS::Lambda::Permission | ApiRouteGETdevnotesmystackApiRouteGET21006C5EPermissionA482583E
dev-notes-my-stack | CREATE_COMPLETE | AWS::CloudFormation::Stack | dev-notes-my-stack

 ✅  dev-notes-my-stack


Stack dev-notes-my-stack
  Status: deployed
  Outputs:
    ApiEndpoint: https://eb4pxg2kyg.execute-api.eu-central-1.amazonaws.com


==========================
 Starting Live Lambda Dev
==========================

Transpiling Lambda code...
Debug session started. Listening for requests...
737fac34-4341-477e-a0c7-8a511e8d97cb REQUEST dev-notes-my-stack-ApiLambdaGETB1714EF3-hglvcqBoj6zs [src/lambda.handler] invoked by API GET /
737fac34-4341-477e-a0c7-8a511e8d97cb RESPONSE {"statusCode":200,"headers":{"Content-Type":"text/plain"},"body":"Hello, World! Your request was received at 16/Oct/2021:19:58:49 +0000."}

Yeah this gets mentioned later (Create a Hello World API) that sst start deploys a debug stack. You might’ve figured this out already but the key aspect of the local development environment is that it is allowing you to test resources that’ve been deployed to AWS.

For the sst.json, we had an update recently that removes the stage option from it. I’ll edit the chapter to reflect that.

1 Like