Back to Prefect

credentials

docs/integrations/prefect-aws/api-ref/prefect_aws-credentials.mdx

3.6.30.dev34.4 KB
Original Source

prefect_aws.credentials

Module handling AWS credentials

Classes

ClientType <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L23" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

The supported boto3 clients.

AwsCredentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L60" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Block used to manage authentication with AWS. AWS authentication is handled via the boto3 module. Refer to the boto3 docs for more info about the possible credential configurations.

Methods:

get_boto3_session <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_boto3_session(self) -> boto3.Session

Returns an authenticated boto3 session that can be used to create clients for AWS services.

If assume_role_arn is provided, this method will assume the specified IAM role and return a session with the temporary credentials from the assumed role.

get_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L230" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_client(self, client_type: Union[str, ClientType])

Helper method to dynamically get a client type.

Args:

  • client_type: The client's service name.

Returns:

  • An authenticated client.

Raises:

  • ValueError: if the client is not supported.

get_s3_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L248" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_s3_client(self) -> 'S3Client'

Gets an authenticated S3 client.

Returns:

  • An authenticated S3 client.

get_secrets_manager_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L257" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_secrets_manager_client(self) -> 'SecretsManagerClient'

Gets an authenticated Secrets Manager client.

Returns:

  • An authenticated Secrets Manager client.

MinIOCredentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L267" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Block used to manage authentication with MinIO. Refer to the MinIO docs for more info about the possible credential configurations.

Attributes:

  • minio_root_user: Admin or root user.
  • minio_root_password: Admin or root password.
  • region_name: Location of server, e.g. "us-east-1".

Methods:

get_boto3_session <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L321" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_boto3_session(self) -> boto3.Session

Returns an authenticated boto3 session that can be used to create clients and perform object operations on MinIO server.

get_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L353" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_client(self, client_type: Union[str, ClientType])

Helper method to dynamically get a client type.

Args:

  • client_type: The client's service name.

Returns:

  • An authenticated client.

Raises:

  • ValueError: if the client is not supported.

get_s3_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-aws/prefect_aws/credentials.py#L371" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_s3_client(self) -> 'S3Client'

Gets an authenticated S3 client.

Returns:

  • An authenticated S3 client.