# AWS Tasks
This module contains a collection of tasks for interacting with AWS resources.
All AWS related tasks can be authenticated using the AWS_CREDENTIALS
Prefect Secret that should be a dictionary with two keys: "ACCESS_KEY"
and "SECRET_ACCESS_KEY"
. See Third Party Authentication for more information.
# S3Download
Task for downloading data from an S3 bucket and returning it as a string. Note that all initialization arguments can optionally be provided or overwritten at runtime.
For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
bucket (str, optional)
: the name of the S3 Bucket to download fromboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.s3.S3Download.run (key, credentials=None, bucket=None, compression=None, as_bytes=False)[source] |
Task run method.
|
# S3Upload
class
prefect.tasks.aws.s3.S3Upload
(bucket=None, boto_kwargs=None, upload_options=None, **kwargs)[source]Task for uploading string data (e.g., a JSON string) to an S3 bucket. Note that all initialization arguments can optionally be provided or overwritten at runtime.
For authentication, there are two options: you can set a Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
bucket (str, optional)
: the name of the S3 Bucket to upload toboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.upload_options (dict, optional)
: Additional options for s3 clientupload_fileobj()
methodExtraArgs
argument**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.s3.S3Upload.run (data, key=None, credentials=None, bucket=None, compression=None, upload_options=None)[source] |
Task run method.
|
# S3List
Task for listing files from an S3 bucket. Note that all initialization arguments can optionally be provided or overwritten at runtime.
For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
bucket (str, optional)
: the name of the S3 Bucket to list the files of.boto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.s3.S3List.run (prefix, delimiter="", page_size=None, max_items=None, credentials=None, bucket=None, last_modified_begin=None, last_modified_end=None)[source] |
Task run method.
|
# LambdaCreate
class
prefect.tasks.aws.lambda_function.LambdaCreate
(function_name, runtime, role, handler, zip_file=None, bucket="", bucket_key="", object_version=None, description="", function_timeout=3, memorysize=128, publish=True, subnet_ids=None, security_group_ids=None, dead_letter_config=None, environment_variables=None, kms_key_arn="", function_tags=None, tracing_config="PassThrough", layers=None, boto_kwargs=None, **kwargs)[source]Task for creating a Lambda function.
Args:
function_name (str)
: name of the Lambda function to createruntime (str)
: the identifier of the function's runtimerole (str)
: the Amazon Resource Name of the function's execution rolehandler (str)
: the name of the method within your code that Lambda calls to execute your functionzip_file (str)
: path to zip file containing code for Lambda function, either zip_file or (bucket and bucket_key) must be passedbucket (str)
: an S3 bucket in the same AWS region as your functionbucket_key (str)
: the Amazon S3 key of the deployment packageobject_version (str, optional)
: for versioned S3 objects, the version of the deployment package to usedescription (str, optional)
: description of Lambda functionfunction_timeout (int, optional)
: Lambda function timeout in seconds, default is 3 secondsmemorysize (int, optional)
: amount of memory that Lambda function has access to in MB, must be a multiple of 64 MB, default is 128publish (bool, optional)
: set to True to publish the first version of the function during creation, defaults to Truesubnet_ids (List[str], optional)
: list of subnet ids for vpc configurationsecurity_group_ids (List[str], optional)
: list of security group ideas for vpc configurationdead_letter_config (dict, optional)
: a dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processingenvironment_variables (dict, optional)
: key-value pairs of environment variables to pass to the Lambda functionkms_key_arn (str, optional)
: the ARN of the AWS key management service used to encrypt your function's environment variables, if not provided, AWS Lambda uses a default service keyfunction_tags (dict, optional)
: a list of tags to apply to the function, string to string maptracing_config (str, optional)
: set to Active to samle and trace a subset of incoming requests with Amazon X-Raylayers (List[str], optional)
: a list of function layers to add to the function's execution environment, specify each layer by its ARNboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.lambda_function.LambdaCreate.run (credentials=None)[source] |
Task run method. Creates Lambda function.
|
# LambdaDelete
class
prefect.tasks.aws.lambda_function.LambdaDelete
(function_name, qualifier="", boto_kwargs=None, **kwargs)[source]Task for deleting a Lambda function.
Args:
function_name (str)
: name of the Lambda function to deletequalifier (str, optional)
: specify a version to delete, if not provided, the function will be deleted entirelyboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.lambda_function.LambdaDelete.run (credentials=None)[source] |
Task run method. Deletes Lambda function.
|
# LambdaInvoke
class
prefect.tasks.aws.lambda_function.LambdaInvoke
(function_name, invocation_type="RequestResponse", log_type="None", client_context=None, payload="null", qualifier="$LATEST", boto_kwargs=None, **kwargs)[source]Task to invoke a Lambda function.
Args:
function_name (str)
: the name of the Lambda funciton to invokeinvocation_type (str, optional)
: the invocation type of Lambda function, default is RequestResponse other options include Event and DryRunlog_type (str, optional)
: set to 'Tail' to include the execution log in the responseclient_context (dict, optional)
: data to pass to the function in the context object, dict object will be transformed into base64 encoded json automaticallypayload (bytes or seekable file-like object)
: the JSON provided to Lambda function as inputqualifier (str, optional)
: specify a version or alias to invoke a published version of the function, defaults to $LATESTboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.lambda_function.LambdaInvoke.run (function_name=None, payload=None, credentials=None)[source] |
Task run method. Invokes Lambda function.
|
# LambdaList
class
prefect.tasks.aws.lambda_function.LambdaList
(master_region="ALL", function_version="ALL", marker=None, max_items=50, boto_kwargs=None, **kwargs)[source]Task to list Lambda functions.
Args:
master_region (str, optional)
: for Lambda@Edge functions, the AWS region of the master functionfunction_version (str, optional)
: the version of a function, default is 'ALL'marker (str, optional)
: specify the pagination token that's returned by a previous request to retreive the next page of resultsmax_items (int, optional)
: specify a value between 1 and 50 to limit the number of functions in the responseboto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.lambda_function.LambdaList.run (credentials=None)[source] |
Task fun method. Lists all Lambda functions.
|
# StepActivate
class
prefect.tasks.aws.step_function.StepActivate
(state_machine_arn=None, execution_name=None, execution_input="{}", boto_kwargs=None, **kwargs)[source]Task for activating an AWS Step Function.
Args:
state_machine_arn (str)
: the Amazon Resource Name (ARN) of the state machine to executeexecution_name (str)
: the name of the execution, this name must be unique for your AWS account, region, and state machine for 90 daysexecution_input (str, optional, DEPRECATED)
: string that contains the JSON input data for the execution, defaults to"{}"
. Settingexecution_input
through the constructor is deprecated. Set it when running this task instead.boto_kwargs (dict, optional)
: additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.step_function.StepActivate.run (credentials=None, state_machine_arn=None, execution_name=None, execution_input=None, boto_kwargs=None)[source] |
Task run method. Activates AWS Step function.
|
# AWSSecretsManager
class
prefect.tasks.aws.secrets_manager.AWSSecretsManager
(secret=None, boto_kwargs=None, **kwargs)[source]Task for retrieving secrets from an AWS Secrets Manager and returning it as a dictionary. Note that all initialization arguments can optionally be provided or overwritten at runtime.
For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
secret (str, optional)
: The name of the secret to retrieve.boto_kwargs (dict, optional)
: Additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: Additional keyword arguments to pass to the Task constructor.
methods: |
---|
prefect.tasks.aws.secrets_manager.AWSSecretsManager.run (secret=None, credentials=None)[source] |
Task run method.
|
# AWSParametersManager
class
prefect.tasks.aws.parameter_store_manager.AWSParametersManager
(parameter_name=None, boto_kwargs=None, **kwargs)[source]Task for retrieving values from AWS SSM Parameters Store and returning the parameter value. Note that all initialization arguments can optionally be provided or overwritten at runtime. For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys, which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
parameter_name (str, optional)
: The name of the parameter to retrieve via SSM.boto_kwargs (dict, optional)
: Additional keyword arguments to forward to the boto client.**kwargs (dict, optional)
: Additional keyword arguments to pass to the Task constructor.
methods: |
---|
prefect.tasks.aws.parameter_store_manager.AWSParametersManager.run (parameter_name=None, credentials=None, boto_kwargs=None)[source] |
Task run method.
|
# BatchSubmit
class
prefect.tasks.aws.batch.BatchSubmit
(job_name=None, job_definition=None, job_queue=None, boto_kwargs=None, **kwargs)[source]Task for submitting a job to AWS batch.
For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
job_name (str, optional)
: The AWS batch job name.job_definition (str, optional)
: The AWS batch job definition.job_queue (str, optional)
: Name of the AWS batch job queue.boto_kwargs (dict, optional)
: additional kekyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.batch.BatchSubmit.run (job_name=None, job_definition=None, job_queue=None, batch_kwargs=None, credentials=None)[source] |
Submit a job to the AWS Batch job service.
|
# AWSClientWait
class
prefect.tasks.aws.client_waiter.AWSClientWait
(client=None, waiter_name=None, waiter_definition=None, boto_kwargs=None, **kwargs)[source]Task for waiting on a long-running AWS job. Uses the underlying boto3 waiter functionality.
For authentication, there are two options: you can set the AWS_CREDENTIALS
Prefect Secret containing your AWS access keys which will be passed directly to the boto3
client, or you can configure your flow's runtime environment for boto3
.
Args:
client (str, optional)
: The AWS client on which to wait (e.g., 'batch', 'ec2', etc)waiter_name (str, optional)
: The name of the waiter to instantiate. Can be a boto-supported waiter or one of prefect's custom waiters. Currently, prefect offers three additional waiters for AWS Batch:"JobExists"
waits for a job to be instantiated,"JobRunning"
waits for a job to start running, and"JobComplete"
waits for a job to finish. You can find the definitions for all prefect-defined waiters here. # noqa You may also use a custom waiter name, if you supply an accompanying waiter definition dict.waiter_definition (dict, optional)
: A valid custom waiter model, as a dict. Note that if you supply a custom definition, it is assumed that the provided 'waiter_name' is contained within the waiter definition dict.boto_kwargs (dict, optional)
: additional kekyword arguments to forward to the boto client.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.aws.client_waiter.AWSClientWait.run (client=None, waiter_name=None, waiter_definition=None, waiter_kwargs=None, credentials=None)[source] |
Task for waiting on a long-running AWS job. Uses the underlying boto3 waiter functionality.
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC