From 257ec3c2f289842817d21c4e771c84ff57d8745e Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Thu, 8 Jun 2023 07:10:34 +0800 Subject: [PATCH 1/3] fix: Don't call EC2 Metadata and allow anonymouse if no cred Signed-off-by: Xuanwo --- src/cache/s3.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cache/s3.rs b/src/cache/s3.rs index cf9531ece..3e8307cc7 100644 --- a/src/cache/s3.rs +++ b/src/cache/s3.rs @@ -37,6 +37,8 @@ impl S3Cache { if no_credentials { builder.disable_config_load(); + builder.disable_ec2_metadata(); + builder.allow_anonymous(); } if let Some(endpoint) = endpoint { From a43b4674481320c08bfad5b41d558fdd3edfeaf4 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Thu, 8 Jun 2023 15:11:55 +0800 Subject: [PATCH 2/3] Add comments Signed-off-by: Xuanwo --- src/cache/s3.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cache/s3.rs b/src/cache/s3.rs index 3e8307cc7..a6f4580ae 100644 --- a/src/cache/s3.rs +++ b/src/cache/s3.rs @@ -37,7 +37,13 @@ impl S3Cache { if no_credentials { builder.disable_config_load(); + // Disable EC2 metadata to avoid OpenDAL trying to load + // credentials from EC2 metadata. + // + // A.k.a, don't try to visit `htpp://169.254.169.254` builder.disable_ec2_metadata(); + // Allow anonymous access to S3 so that OpenDAL will not + // throw error when no credentials are provided. builder.allow_anonymous(); } From b5d27af1d530b09a25410ed17d9e58399c431ce5 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Thu, 8 Jun 2023 15:13:53 +0800 Subject: [PATCH 3/3] Fix typo Signed-off-by: Xuanwo --- src/cache/s3.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache/s3.rs b/src/cache/s3.rs index a6f4580ae..db039ea8f 100644 --- a/src/cache/s3.rs +++ b/src/cache/s3.rs @@ -40,7 +40,7 @@ impl S3Cache { // Disable EC2 metadata to avoid OpenDAL trying to load // credentials from EC2 metadata. // - // A.k.a, don't try to visit `htpp://169.254.169.254` + // A.k.a, don't try to visit `http://169.254.169.254` builder.disable_ec2_metadata(); // Allow anonymous access to S3 so that OpenDAL will not // throw error when no credentials are provided.