Skip to main content

ConnectorTypeAWS

class connector_types.connector_type_aws.ConnectorTypeAWS

Call the AWS API using the Boto3 low-level clients. Consult the Boto3 documentation for details on clients, services, waiters, and results.

Inputs

NameTypeDefaultDescription
aws_access_key_idstrThe AWS access key to authenticate
aws_secret_access_keystrThe AWS secret access key to authenticate
clientstrThe name of the boto3 client to use. E.g. "ec2"
parametersdictNoneAny parameters to pass to the service or waiter call
regionstrNoneThe region in which to operate
servicestrNoneThe service of the selected client to call. Either "service" or "waiter" is required.
waiterstrNoneThe waiter of the selected client to use. Either "service" or "waiter" is required.

Outputs

NameTypeDefaultDescription
execution_idintThe ID of the connection execution
messagestrThe ended message for the connection. If the connection ended with an error, the message will contain information about what went wrong
resultdictThe result dictionary returned by boto3
statusstrThe ended status for the connection. Either "success" or "error".

Constants

input_list = ['aws_access_key_id', 'aws_secret_access_key', 'client', 'parameters', 'region', 'service', 'waiter']output_list = ['result']version = 1

Methods

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
# get AWS credentials from setting
credentials = system.setting('aws credentials').get('value')
# create a child execution connection which talks with AWS
run_instance = this.connect(
connector_type='AWS',
region='eu-central-1',
client='ec2',
service='run_instances',
parameters={
'ImageId': 'ami-0f5dbc86dd9cbf7a8',
'InstanceType': 't2.micro',
'MaxCount': 1,
'MinCount': 1,
},
**credentials
)
# provide the response back to the caller
run_instance_outputs = run_instance.get('output_value')
this.log(run_instance_outputs=run_instance_outputs)
# wait until the instance is running
instance_id = run_instance_outputs['result']['Instances'][0]['InstanceId']
wait_available = this.connect(
connector_type='AWS',
region='eu-central-1',
client='ec2',
waiter='instance_running',
parameters={
'InstanceIds': [
instance_id,
]
},
**credentials
)
# provide the response back to the caller
wait_available_outputs = wait_available.get('output_value')
this.log(wait_available_outputs=wait_available_outputs)
return this.success('all done')