sam list endpoints - Amazon Serverless Application Model
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

sam list endpoints

本页提供 Amazon Serverless Application Model 命令行界面 (Amazon SAMCLI) sam list endpoints 子命令的参考信息。

有关简介 Amazon SAMCLI,请参阅那是什么 Amazon SAMCLI?

sam list endpoints子命令显示 Amazon CloudFormation 堆栈中的云端和本地端点列表。您可以通过 sam localsam sync 命令与这些资源进行交互。

Amazon Lambda 此命令支持 Amazon API Gateway 资源类型。

注意

如果为 Amazon API Gateway 资源配置了自定义域,则这些域受支持。此命令会输出自定义域而不是默认端点。

使用量

$ sam list endpoints <options>

Options

--config-env TEXT

在配置文件中指定要使用的默认参数值的环境名称。

默认值default

有关配置文件的详细信息,请参阅 Amazon SAMCLI 配置文件

--config-file TEXT

包含要使用的默认参数值的配置文件的路径和文件名。

默认值:当前工作目录中 samconfig.toml

有关配置文件的详细信息,请参阅 Amazon SAMCLI 配置文件

--debug

启用调试日志记录,以打印由 Amazon SAM CLI 生成的带有时间戳的调试消息。

--help, -h

显示此消息并退出。

--output [json|table]

指定输出结果的格式。

默认值table

--profile TEXT

从您的凭证文件中选择一个特定的个人资料以获取 Amazon 凭证。

--region TEXT

设置服务的 Amazon 区域。例如,us-east-1

--save-params

将您在命令行中提供的参数保存到 Amazon SAM 配置文件中。

--stack-name TEXT

已部署 Amazon CloudFormation 堆栈的名称。可在应用程序的 samconfig.toml 文件或指定的配置文件中找到堆栈名称。

如果未指定此选项,则会显示模板中定义的本地资源。

--template-file, --template, -t PATH

Amazon SAM 模板文件。

默认值template.[yaml|yml|json]

示例

以 json 格式显示名为的 Amazon CloudFormation 堆栈中已部署的资源端点的输出test-stack

$ sam list endpoints --stack-name test-stack --output json [ { "LogicalResourceId": "HelloWorldFunction", "PhysicalResourceId": "sam-app-test-list-HelloWorldFunction-H85Y7yIV7ZLq", "CloudEndpoint": "https://zt55oi7kbljxjmcoahsj3cknwu0rposq.lambda-url.us-east-1.on.aws/", "Methods": "-" }, { "LogicalResourceId": "ServerlessRestApi", "PhysicalResourceId": "uj80uoe2o2", "CloudEndpoint": [ "https://uj80uoe2o2.execute-api.us-east-1.amazonaws.com/Prod", "https://uj80uoe2o2.execute-api.us-east-1.amazonaws.com/Stage" ], "Methods": [ "/hello['get']" ] } ]