aws:executeGcpApi – Call and run Google Cloud API operations
The aws:executeGcpApi action calls a Google Cloud API
method in the Google Cloud projects that a Cloud Connector allows. Automation calls the operation
with the Google Cloud client libraries for Python and returns the response as
a JSON object, so you can select values from it the same way as for aws:executeAwsApi – Call and run AWS API operations.
The aws:executeGcpApi action is available in the AWS Regions where
Cloud Connector is available.
Input
You provide Service, Api, Package, and
CloudConnector. Each other input is a field of the method's request. You
can give the request body in Body instead of the request field that holds
it.
- Service
-
The client library name, as in
google.cloud.without the version, for exampleservicesecretmanager,kmsorresourcemanager. It is not the API's host name (cloudkms).Type: String
Required: Yes
- Api
-
from the API's RPC reference, for exampleService.MethodSecretManagerService.ListSecrets.Type: String
Required: Yes
- Package
-
The name of the published Google Cloud package that provides the operation. For more information about the available packages and the libraries in each, see Azure and Google Cloud SDK packages.
Type: String
Required: Yes
- CloudConnector
-
The ID of the Cloud Connector for the Google Cloud projects that the step acts on. For example,
a1b2c3d4-5678-90ab-cdef-111122223333.Type: String
Required: Yes
- Request fields
-
One input per field, named as in either the RPC or the REST reference (
pageSizeorpage_size). The project goes inproject,name,parentorresource, and it must be one of the Cloud Connector's projects.Type: Determined by the chosen API operation
Required: Determined by the chosen API operation
- Body
-
The request body, as a JSON object in the shape that the method's REST reference shows.
Type: StringMap (a JSON object; values can be nested objects and lists)
Required: No
Outputs
You specify outputs based on the response from the chosen API operation.
- Name
-
A name for the output.
Type: String
Required: Yes
- Selector
-
Selectors over the response JSON from the REST reference.
-
Field names are camelCase (
createTime). -
Enums come back as names, and 64-bit integers as strings.
-
A list method returns one page with
nextPageToken. Pass that back aspageTokento get the next page.
Use output type
Stringfor 64-bit integers, such asidanddiskSizeGb. Except in Compute Engine, a field that has its default value (false,0, or an empty string) is left out of the response, as in the REST API.For more information about the JSONPath that you can use, see Select values from the response.
Type: String
Required: Yes
-
- Type
-
The data type for the response element. Valid values:
String,Integer,Boolean,StringList,StringMap,MapList.Type: String
Required: Yes
Credentials and permissions
Before the step runs, Automation gets a short-lived Google Cloud access
token for the connector's service account. If the automation has an
AutomationAssumeRole, that role assumes the connector's federation
role. Otherwise, the identity that started the automation does. For more information about the permissions
that each role needs, see Permissions for automations that use a Cloud Connector.
Find a method
To find a method and its request fields, see Google Cloud APIs
Limitations
The following limitations apply to aws:executeGcpApi,
aws:assertGcpResourceProperty, and
aws:waitForGcpResourceProperty.
-
Each call returns one page and doesn't wait for a long-running operation to finish. Compute Engine returns the
Operationresource, with astatusofPENDING,RUNNING, orDONE. Other services return a long-running operation with aname, and"done": truewhen it finishes. -
Each call can run for up to 30 seconds. If Google Cloud doesn't respond in that time, the step fails with
Provider API dispatch timed out. -
Automation rejects a request that names no project in
project,name,parent, orresource, withThe request does not name a GCP project, so it cannot be authorized against the Cloud Connector's scope.This includes organization, folder, and billing-account resources, methods that take the project in another field, such as Pub/SubPublisher.GetTopic(topic) and Dataproc (projectId), and update methods whose resource name is inside a request field, such asAlertPolicyService.UpdateAlertPolicy. -
Give a project ID, not a project number. Automation rejects a project number,
projects/-, and a project outside the connector, including public image projects such asdebian-cloud, withThe GCP project 'If the connector covers a whole organization, any project ID is accepted.project' is not in the list of allowed projects for this Cloud Connector. -
The IAM policy methods (
GetIamPolicy,SetIamPolicy, andTestIamPermissions) are supported only for Compute Engine. -
A 32-bit integer field, such as
maxResultsorpageSize, must be a number. A value from a runbook parameter of typeStringis rejected; use typeInteger. 64-bit integers can be numbers or strings. -
Give a nested field as an object, not as a dotted name. For example, use
interval: {startTime: '2026-01-01T00:00:00Z'}, notinterval.startTime. -
A bytes field must be base64-encoded, as in the REST API. Automation doesn't reject plain text, so plain text is sent as different bytes.
-
The package sets each library's API version. A field that the reference shows but the package's library doesn't have, such as
returnPartialSuccess, or a REST system parameter such asfields, is rejected as an unknown parameter.
To call a service or operation that isn't supported, use a Python script in
aws:executeScript with the same package. For more information, see aws:executeScript – Run a script.
Example – Get a virtual machine instance
The following step gets a virtual machine instance and returns its state. Replace the Cloud Connector ID with your own.
The following YAML and JSON examples show a step that resizes a persistent disk to
200 GB. Disks.Resize returns
the Operation resource as soon as Google Cloud accepts the
request, so OperationStatus is usually RUNNING or
PENDING. To wait until the resize finishes, pass OperationName as the
operation field of a ZoneOperations.Get step in
aws:waitForGcpResourceProperty, with the PropertySelector
$.status and the DesiredValues DONE. An operation
that failed also reaches DONE, and has an error property.
If Google Cloud rejects the call, the step fails with GCP client
error ( followed by Google
Cloud's message, for example status):GCP client error (403) when the
connector's service account lacks a permission. Automation also fails the step before it
calls Google Cloud when the service, method, a request field, or the project
isn't valid. The message names the problem. To let the automation continue after a failure, set
onFailure on the step. For common errors, see Troubleshooting automations that use a Cloud Connector.