From 577bd85654cf6d4cd1b15ef884b46f3db55920de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=E2=98=BC=20McSherry=E2=98=BC?= Date: Wed, 24 Jan 2024 08:20:53 -0800 Subject: [PATCH] Allow any AWS authentication method in studios (#19336) --- src/lightning/data/streaming/client.py | 10 +--------- tests/tests_data/streaming/test_client.py | 6 ------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/lightning/data/streaming/client.py b/src/lightning/data/streaming/client.py index cfe757537d..c42d3af9f6 100644 --- a/src/lightning/data/streaming/client.py +++ b/src/lightning/data/streaming/client.py @@ -7,8 +7,6 @@ from lightning.data.streaming.constants import _BOTO3_AVAILABLE if _BOTO3_AVAILABLE: import boto3 import botocore - from botocore.credentials import InstanceMetadataProvider - from botocore.utils import InstanceMetadataFetcher class S3Client: @@ -31,14 +29,8 @@ class S3Client: # Re-generate credentials for EC2 if self._last_time is None or (time() - self._last_time) > self._refetch_interval: - provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=3600, num_attempts=5)) - credentials = provider.load() self._client = boto3.client( - "s3", - aws_access_key_id=credentials.access_key, - aws_secret_access_key=credentials.secret_key, - aws_session_token=credentials.token, - config=botocore.config.Config(retries={"max_attempts": 1000, "mode": "adaptive"}), + "s3", config=botocore.config.Config(retries={"max_attempts": 1000, "mode": "adaptive"}) ) self._last_time = time() diff --git a/tests/tests_data/streaming/test_client.py b/tests/tests_data/streaming/test_client.py index 0b18a2ae98..e4d9d80cbd 100644 --- a/tests/tests_data/streaming/test_client.py +++ b/tests/tests_data/streaming/test_client.py @@ -31,12 +31,6 @@ def test_s3_client_with_cloud_space_id(monkeypatch): botocore = mock.MagicMock() monkeypatch.setattr(client, "botocore", botocore) - instance_metadata_provider = mock.MagicMock() - monkeypatch.setattr(client, "InstanceMetadataProvider", instance_metadata_provider) - - instance_metadata_fetcher = mock.MagicMock() - monkeypatch.setattr(client, "InstanceMetadataFetcher", instance_metadata_fetcher) - monkeypatch.setenv("LIGHTNING_CLOUD_SPACE_ID", "dummy") s3 = client.S3Client(1)