Skip to content

Instantly share code, notes, and snippets.

@iamjenechka
Last active April 2, 2024 13:42
Show Gist options
  • Save iamjenechka/bd068f7077b117f085ebdaf7d14b254c to your computer and use it in GitHub Desktop.
Save iamjenechka/bd068f7077b117f085ebdaf7d14b254c to your computer and use it in GitHub Desktop.
Getting s3 connection uri for airflow
import json
from airflow.models.connection import Connection
c = Connection(
conn_id='s3conn',
conn_type='s3',
extra=json.dumps({"host":"http://hostname/", "aws_access_key_id":"id", "aws_secret_access_key": "secret"}),
)
c.get_uri()
>>> 's3://?host=http%3A%2F%2Fhostname%2F&aws_access_key_id=id&aws_secret_access_key=secret'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment