mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
* docs: update and consolidate param docs * docs: add reference to dev in workflow tips * docs: moving variables into section * docs: refactor variables into dedicated files * docs: adds terraform resolver docs * docs: updating per terraform resolver changes * docs: adding terraform remote variable resolver * docs: fix links in headers * docs: add docs for vault resolver * docs: adding note on AWS accounts to TF resolver * docs: refactor terraform & add http config * docs: fixing provider links * docs: move workflow out of aws guides * docs: update menu link for new workflow location
92 lines
2.0 KiB
Markdown
92 lines
2.0 KiB
Markdown
<!--
|
|
title: Serverless Framework Commands - AWS Lambda - Print
|
|
menuText: print
|
|
menuOrder: 22
|
|
description: Print your config with all variables resolved for debugging
|
|
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/print)
|
|
|
|
<!-- DOCS-SITE-LINK:END -->
|
|
|
|
# Print
|
|
|
|
Print your `serverless.yml` config file with all variables resolved.
|
|
|
|
If you're using [Serverless Variables](https://serverless.com/framework/docs/guides/variables/) in your `serverless.yml`, it can be difficult to know if your syntax is correct or if the variables are resolving as you expect.
|
|
|
|
With this command, it will print the fully-resolved config to your console.
|
|
|
|
```bash
|
|
serverless print
|
|
```
|
|
|
|
## Options
|
|
|
|
- `format` Print configuration in given format ("yaml", "json", "text"). Default: yaml
|
|
- `path` Period-separated path to print a sub-value (eg: "provider.name")
|
|
- `transform` Transform-function to apply to the value (currently only "keys" is supported)
|
|
|
|
## Examples:
|
|
|
|
Assuming you have the following config file:
|
|
|
|
```yml
|
|
service: my-service
|
|
|
|
custom:
|
|
bucketName: test
|
|
|
|
provider:
|
|
name: aws
|
|
runtime: nodejs14.x
|
|
|
|
functions:
|
|
hello:
|
|
handler: handler.hello
|
|
|
|
resources:
|
|
Resources:
|
|
MyBucket:
|
|
Type: AWS::S3::Bucket
|
|
Properties:
|
|
BucketName: ${self:custom.bucketName}
|
|
```
|
|
|
|
Using `sls print` will resolve the variables in `provider.stage` and `BucketName`.
|
|
|
|
```bash
|
|
$ sls print
|
|
service: my-service
|
|
custom:
|
|
bucketName: test
|
|
provider:
|
|
name: aws
|
|
runtime: nodejs14.x
|
|
stage: dev # <-- Resolved
|
|
functions:
|
|
hello:
|
|
handler: handler.hello
|
|
resources:
|
|
Resources:
|
|
MyBucket:
|
|
Type: 'AWS::S3::Bucket'
|
|
Properties:
|
|
BucketName: test # <-- Resolved
|
|
```
|
|
|
|
This prints the provider name:
|
|
|
|
```bash
|
|
sls print --path provider.name --format text
|
|
```
|
|
|
|
And this prints all function names:
|
|
|
|
```bash
|
|
sls print --path functions --transform keys --format text
|
|
```
|