aws:executeAwsApi - 调用并运行 Amazon API 操作 - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

aws:executeAwsApi - 调用并运行 Amazon API 操作

调用并运行 Amazon API 操作。支持大多数 API 操作,但某些 API 操作未经过测试。不支持流式处理 API 操作,例如 GetObject 操作。如果不确定要使用的 API 操作是否属于流式操作,请查看该服务的 Boto3 文档,判断该 API 是否需要流式输入或输出。我们会定期更新此操作使用的 Boto3 版本。但是,在新的 Boto3 版本发布后,可能需要长达几周的时间才能将更改反映到此操作中。每个 aws:executeAwsApi 操作最多可以运行 25 秒。有关如何使用此操作的更多示例,请参阅 其他运行手册示例

输入

由您选择的 API 操作定义的输入。

YAML
action: aws:executeAwsApi inputs: Service: The official namespace of the service Api: The API operation or method name API operation inputs or parameters: A value outputs: # These are user-specified outputs - Name: The name for a user-specified output key Selector: A response object specified by using jsonpath format Type: The data type
JSON
{ "action":"aws:executeAwsApi", "inputs":{ "Service":"The official namespace of the service", "Api":"The API operation or method name", "API operation inputs or parameters":"A value" }, "outputs":[ These are user-specified outputs { "Name":"The name for a user-specified output key", "Selector":"A response object specified by using JSONPath format", "Type":"The data type" } ] }
服务

包含要运行的 API 操作的 Amazon Web Service命名空间。您可以在 Amazon SDK for Python (Boto3) 的可用服务中查看支持的 Amazon Web Service命名空间列表。可以在客户端部分找到此命名空间。例如,Systems Manager 的命名空间为 ssm。Amazon Elastic Compute Cloud (Amazon EC2) 的命名空间为 ec2

类型:字符串

必需:是

API

要运行的 API 操作的名称。您可以在以下服务参考页面的左侧导航栏中选择服务来查看 API 操作(也称为方法)。在要调用的服务的客户端部分中选择一种方法。例如,下面的 Amazon RDS 方法页面中列出了 Amazon Relational Database Service (Amazon RDS) 的所有 API 操作(方法)。

类型:字符串

必需:是

API 操作输入

一个或多个 API 操作输入。您可以在以下服务参考页面的左侧导航栏中选择服务来查看可用的输入(也称为参数)。在要调用的服务的客户端部分中选择一种方法。例如,下面的 Amazon RDS 方法页面中列出了 Amazon RDS 的所有方法。选择 describe_db_instances 方法并向下滚动以查看可用的参数,例如 DBInstanceIdentifierNameValues

YAML
inputs: Service: The official namespace of the service Api: The API operation name API input 1: A value API Input 2: A value API Input 3: A value
JSON
"inputs":{ "Service":"The official namespace of the service", "Api":"The API operation name", "API input 1":"A value", "API Input 2":"A value", "API Input 3":"A value" }

类型:由选择的 API 操作确定

必需:是

输出

输出由用户根据所选 API 操作的响应指定。

名称

输出的名称。

类型:字符串

必需:是

Selector

响应对象中特定属性的 JSONPath。您可以在以下服务参考页面的左侧导航栏中选择服务来查看响应对象。在要调用的服务的客户端部分中选择一种方法。例如,下面的 Amazon RDS 方法页面中列出了 Amazon RDS 的所有方法:选择 describe_db_instances 方法,然后向下滚动到响应结构部分。DBInstances 被列为响应对象。

类型:Integer、Boolean、String、StringList、StringMap 或 MapList

必需:是

类型

响应元素的数据类型。

类型:可变

必需:是