Merge pull request #2926 from serverless/doc-updates

separate commands into separate pages
This commit is contained in:
Austen 2016-12-12 20:17:24 -08:00 committed by GitHub
commit c41a39cbaa
12 changed files with 140 additions and 54 deletions

View File

@ -52,7 +52,10 @@ The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, e
<li><a href="./providers/aws/cli-reference/create.md">Create</a></li>
<li><a href="./providers/aws/cli-reference/install.md">Install</a></li>
<li><a href="./providers/aws/cli-reference/deploy.md">Deploy</a></li>
<li><a href="./providers/aws/cli-reference/deploy-function.md">Deploy Function</a></li>
<li><a href="./providers/aws/cli-reference/deploy-list.md">Deploy List</a></li>
<li><a href="./providers/aws/cli-reference/invoke.md">Invoke</a></li>
<li><a href="./providers/aws/cli-reference/invoke-local.md">Invoke Local</a></li>
<li><a href="./providers/aws/cli-reference/logs.md">Logs</a></li>
<li><a href="./providers/aws/cli-reference/metrics.md">Metrics</a></li>
<li><a href="./providers/aws/cli-reference/info.md">Info</a></li>

View File

@ -0,0 +1,38 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Deploy Function
menuText: Deploy Function
menuOrder: 5
description: Deploy your AWS Lambda functions quickly without cloudformation
layout: Doc
-->
<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy-function)
<!-- DOCS-SITE-LINK:END -->
# Deploy Function
The `sls deploy function` command deploys an individual function without AWS CloudFormation. This command simply swaps out the zip file that your CloudFormation stack is pointing toward. This is a much faster way of deploying changes in code.
```bash
serverless deploy function -f functionName
```
## Options
- `--function` or `-f` The name of the function which should be deployed
- `--stage` or `-s` The stage in your service that you want to deploy to.
- `--region` or `-r` The region in that stage that you want to deploy to.
## Examples
### Deployment without stage and region options
```bash
serverless deploy function --function helloWorld
```
### Deployment with stage and region options
```bash
serverless deploy function --function helloWorld --stage dev --region us-east-1
```

View File

@ -0,0 +1,32 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Deploy List
menuText: Deploy List
menuOrder: 6
description: List your previous CloudFormation deployments
layout: Doc
-->
<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy-list)
<!-- DOCS-SITE-LINK:END -->
# Deploy List
The `sls deploy list` command will list your recent deployments available in your S3 deployment bucket. It will use stage and region from the provider config and show the timestamp of each deployment so you can roll back if necessary using `sls rollback`.
## Options
- `--stage` or `-s` The stage in your service that you want to deploy to.
- `--region` or `-r` The region in that stage that you want to deploy to.
## Artifacts
After the `serverless deploy` command runs all created deployment artifacts are placed in the `.serverless` folder of the service.
## Examples
### List existing deploys
```bash
serverless deploy list --stage dev --region us-east-1
```

View File

@ -12,25 +12,13 @@ layout: Doc
# Deploy
The `sls deploy` command deploys your service or an individual function.
**Deploy entire service:**
The `sls deploy` command deploys your entire service via CloudFormation. Run this command when you have made infrastructure changes (i.e., you edited `serverless.yml`). Use `serverless deploy function -f myFunction` when you have made code changes and you want to quickly upload your updated code to AWS Lambda.
```bash
serverless deploy
```
**Deploy a single function:**
```bash
serverless deploy function -f functionName
```
**Note:** `sls deploy function` is faster than a full service deploy and recommended for a faster development flow
## Options
- `--function` or `-f` The name of the function which should be deployed (**Note:** only available when running
`serverless deploy function`)
- `--stage` or `-s` The stage in your service that you want to deploy to.
- `--region` or `-r` The region in that stage that you want to deploy to.
- `--noDeploy` or `-n` Skips the deployment steps and leaves artifacts in the `.serverless` directory
@ -60,14 +48,6 @@ serverless deploy --stage production --region eu-central-1
With this example we've defined that we want our service to be deployed to the `production` stage in the region
`eu-central-1`.
## List existing deploys
```bash
serverless deploy list
```
Running this command will list your recent deployments available in your S3 deployment bucket. It will use stage and region from the provider config and show the timestamp of each deployment so you can roll back if necessary.
## Provided lifecycle events
- `deploy:cleanup`
- `deploy:initialize`

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Info
menuText: Info
menuOrder: 8
menuOrder: 11
description: Display information about your deployed service and the AWS Lambda Functions, Events and AWS Resources it contains.
layout: Doc
-->

View File

@ -0,0 +1,59 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Invoke Local
menuText: Invoke Local
menuOrder: 8
description: Emulate an invocation of your AWS Lambda function locally using the Serverless Framework
layout: Doc
-->
<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/invoke-local)
<!-- DOCS-SITE-LINK:END -->
# Invoke Local
This runs your code locally by emulating the AWS Lambda environment. Please keep in mind, it's not a 100% perfect emulation, there may be some differences, but it works for the vast majority of users. We mock the `context` with simple mock data.
```bash
serverless invoke local --function functionName
```
## Options
- `--function` or `-f` The name of the function in your service that you want to invoke locally. **Required**.
- `--path` or `-p` The path to a json file holding input data to be passed to the invoked function. This path is relative to the root directory of the service. The json file should have event and context properties to hold your mocked event and context data.
- `--data` or `-d` String data to be passed as an event to your function. Keep in mind that if you pass both `--path` and `--data`, the data included in the `--path` file will overwrite the data you passed with the `--data` flag.
## Examples
### Local function invocation
```bash
serverless invoke local --function functionName
```
This example will locally invoke your function.
### Local function invocation with data
```bash
serverless invoke --function functionName --data "hello world"
```
```bash
serverless invoke --function functionName --data '{"a":"bar"}'
```
### Local function invocation with data from standard input
```bash
dataGenerator.js | serverless invoke local --function functionName
```
### Local function invocation with data passing
```bash
serverless invoke local --function functionName --path lib/data.json
```
This example will pass the json data in the `lib/data.json` file (relative to the root of the service) while invoking the specified/deployed function.

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Invoke
menuText: Invoke
menuOrder: 5
menuOrder: 7
description: Invoke an AWS Lambda Function using the Serverless Framework
layout: Doc
-->
@ -84,29 +84,3 @@ serverless invoke --function functionName --stage dev --region us-east-1 --path
This example will pass the json data in the `lib/data.json` file (relative to the root of the service) while invoking
the specified/deployed function.
#### Local function invocation
```bash
serverless invoke local --function functionName
```
This example will locally invoke your function.
#### Local function invocation with event data
You can input test data in `event.json` file inside your service directory:
```json
{
"foo": "bar"
}
```
and then pass it with the command
```bash
serverless invoke local --function functionName --path event.json
```
This example will locally invoke your function.

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Logs
menuText: Logs
menuOrder: 6
menuOrder: 9
description: View logs of your AWS Lambda Function within your terminal using the Serverless Framework
layout: Doc
-->

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Metrics
menuText: Metrics
menuOrder: 7
menuOrder: 10
description: View metrics of your AWS Lambda Function within your terminal using the Serverless Framework
layout: Doc
-->

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Remove
menuText: Remove
menuOrder: 10
menuOrder: 13
description: Remove a deployed Service and all of its AWS Lambda Functions, Events and Resources
layout: Doc
-->

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Rollback CLI Command
menuText: Rollback
menuOrder: 9
menuOrder: 12
description: Rollback the Serverless service to a specific deployment
layout: Doc
-->

View File

@ -1,7 +1,7 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Serverless Stats
menuText: Serverless Stats
menuOrder: 11
menuOrder: 14
description: Enables or disables Serverless Statistic logging within the Serverless Framework.
layout: Doc
-->