Skip to content

Commit 577bd85

Browse files
authored
Allow any AWS authentication method in studios (#19336)
1 parent 71bfdc3 commit 577bd85

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/lightning/data/streaming/client.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
if _BOTO3_AVAILABLE:
88
import boto3
99
import botocore
10-
from botocore.credentials import InstanceMetadataProvider
11-
from botocore.utils import InstanceMetadataFetcher
1210

1311

1412
class S3Client:
@@ -31,14 +29,8 @@ def client(self) -> Any:
3129

3230
# Re-generate credentials for EC2
3331
if self._last_time is None or (time() - self._last_time) > self._refetch_interval:
34-
provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=3600, num_attempts=5))
35-
credentials = provider.load()
3632
self._client = boto3.client(
37-
"s3",
38-
aws_access_key_id=credentials.access_key,
39-
aws_secret_access_key=credentials.secret_key,
40-
aws_session_token=credentials.token,
41-
config=botocore.config.Config(retries={"max_attempts": 1000, "mode": "adaptive"}),
33+
"s3", config=botocore.config.Config(retries={"max_attempts": 1000, "mode": "adaptive"})
4234
)
4335
self._last_time = time()
4436

tests/tests_data/streaming/test_client.py

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ def test_s3_client_with_cloud_space_id(monkeypatch):
3131
botocore = mock.MagicMock()
3232
monkeypatch.setattr(client, "botocore", botocore)
3333

34-
instance_metadata_provider = mock.MagicMock()
35-
monkeypatch.setattr(client, "InstanceMetadataProvider", instance_metadata_provider)
36-
37-
instance_metadata_fetcher = mock.MagicMock()
38-
monkeypatch.setattr(client, "InstanceMetadataFetcher", instance_metadata_fetcher)
39-
4034
monkeypatch.setenv("LIGHTNING_CLOUD_SPACE_ID", "dummy")
4135

4236
s3 = client.S3Client(1)

0 commit comments

Comments
 (0)