Make sure serverless
is installed. See installation guide.
Once installed the Serverless CLI can be called with serverless
or the shorthand sls
command.
If sls
command returns an error in PowerShell, please use serverless
command.
$ sls
Commands
* You can run commands with "serverless" or the shortcut "sls"
* Pass "--verbose" to this command to get in-depth plugin info
* Pass "--no-color" to disable CLI colors
* Pass "--help" after any <command> for contextual help
sls create --template aws-csharp --path myService
Using the create
command we can specify one of the available templates. For this example use aws-csharp with the --template
or shorthand -t
flag.
The --path
or shorthand -p
is the location to be created with the template service files. Change directories into this new folder.
# Linux or Mac OS
./build.sh
# Windows PowerShell
.\build.cmd
sls deploy
This will deploy your function to AWS Lambda based on the settings in serverless.yml
.
sls invoke -f hello
Invoke deployed function with command invoke
and --function
or shorthand -f
.
In your terminal window you should see the response from AWS Lambda.
{
"Message": "Go Serverless v1.0! Your function executed successfully!",
"Request": {
"Key1": null,
"Key2": null,
"Key3": null
}
}
Congrats you have deployed and ran your Hello World function!
Product