amazon-web-servicesasp.net-coreaws-lambdaaws-cloudformationaws-toolkit

What commands are being run by VS to publish .net core serverless applications?


I'm reading this doc: https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/lambda-build-test-severless-app.html

I created a serverless app using the "Blog API using DynamoDB" template.

When I publish from VS it deploys it to AWS as a serverless app, but what commands is it running? How can I publish it from the command line (without VS)?

When I look at the serverless.template file the project comes with I just see parameter and resource definitions for AWS::Serverless::Functions and the DynamoDB table- where is the pointer/config that register this as a "Application" in the lambda console- and not just a bunch of functions?


Solution

  • It's using the Serverless Application Model (or SAM for short). It's an abstraction on top of standard Cloudformation templates - it allows you to declare serverless application resources in a more succinct way. It also comes with a CLI. My guess would be that's what's running behind the scenes.

    You can try it by yourself. After installing the SAM CLI, run sam build, sam package and sam deploy. That should get you off the ground.

    sam build --template serverless.template # --use-container if necessary, needs Docker
    sam package --output-template-file packaged.yml --s3-bucket ARTIFACTS_BUCKET
    sam deploy --template-file packaged.yml --stack-name my-serverless-app --capabilities CAPABILITY_IAM