 asked to access:

from zenml.client import Clientclient = Client()

# Get a Service Connector client for a particular S3 bucket

connector_client = client.get_service_connector_client(

name_id_or_prefix="aws-federation-multi",

resource_type="s3-bucket",

resource_id="s3://zenfiles"

# Get the S3 boto3 python client pre-configured and pre-authenticated

# from the Service Connector client

s3_client = connector_client.connect()

# Verify access to the chosen S3 bucket using the temporary token that

# was issued to the client.

s3_client.head_bucket(Bucket="zenfiles")

# Try to access another S3 bucket that the original AWS long-lived credentials can access.

# An error will be thrown indicating that the bucket is not accessible.

s3_client.head_bucket(Bucket="zenml-demos")

Example Output

>>> from zenml.client import Client

>>>

>>> client = Client()

Unable to find ZenML repository in your current working directory (/home/stefan/aspyre/src/zenml) or any parent directories. If you want to use an existing repository which is in a different location, set the environment variable 'ZENML_REPOSITORY_PATH'. If you want to create a new repository, run zenml init.

Running without an active repository root.

>>>

>>> # Get a Service Connector client for a particular S3 bucket

>>> connector_client = client.get_service_connector_client(

...     name_id_or_prefix="aws-federation-multi",

...     resource_type="s3-bucket",

...     resource_id="s3://zenfiles"

... )

>>>

>>> # Get the S3 boto3 python client pre-configured and pre-authenticated

>>> # from the Service Connector client

>>> s3_client = connector_client.connect()

>>>

>>> # Verify access to the chosen S3 bucket using the temporary token that

>>> # was issued to the client.

>>> s3_client.head_bucket(Bucket="zenfiles")