Taragolis commented on code in PR #34729:
URL: https://github.com/apache/airflow/pull/34729#discussion_r1365808618


##########
airflow/providers/amazon/aws/fs/s3.py:
##########
@@ -0,0 +1,131 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import logging
+from functools import partial
+from typing import TYPE_CHECKING, Any, Callable, Dict
+
+import requests
+from botocore import UNSIGNED
+from requests import HTTPError
+
+from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
+
+if TYPE_CHECKING:
+    from botocore.awsrequest import AWSRequest
+    from fsspec import AbstractFileSystem
+
+
+Properties = Dict[str, str]
+
+S3_PROXY_URI = "s3.proxy-uri"
+
+log = logging.getLogger(__name__)
+
+schemes = ["s3", "s3a", "s3n"]
+
+
+class SignError(Exception):
+    """Raises when unable to sign a S3 request."""
+
+
+def get_fs(conn_id: str | None) -> AbstractFileSystem:
+    try:
+        from s3fs import S3FileSystem
+    except ImportError:
+        raise ImportError(
+            "Airflow FS S3 protocol requires the s3fs library, but it is not 
installed as it requires"
+            "aiobotocore. Please install the s3 protocol support library by 
running: "
+            "pip install apache-airflow[s3]"
+        )
+
+    if conn_id is None:
+        return S3FileSystem()
+
+    aws: AwsGenericHook = AwsGenericHook(aws_conn_id=conn_id)

Review Comment:
   Yep, kind of, it just use default `boto3` behaviour: 
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials
   
   Most of them controlled by environment variables, but some of them checked 
is it run inside of EC2/ECS/EKS and try to get IAM profile from this metadata



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to