@@ -40,7 +40,7 @@ function AWSCredentials(profile::String="", load::Bool=true; expireThreshold=Dat
4040end
4141
4242getCredentialsFile () = get (AWS_CONFIGS, " aws_shared_credentials_file" , joinpath (homedir (), " .aws" , " credentials" ))
43- getConfigFile () = get (AWS_CONFIGS, " aws_config_file" , joinpath (homedir (), " .aws" , " config" ))
43+ getConfigFile () = get (AWS_CONFIGS, " aws_config_file" , joinpath (homedir (), " .aws" , " config" ))
4444
4545function awsLoadConfig! (profile:: String = " " , expireThreshold= Dates. Minute (5 ))
4646 # on each fresh load, we want to clear out potentially stale credential fields
@@ -76,7 +76,7 @@ function awsLoadConfig!(profile::String="", expireThreshold=Dates.Minute(5))
7676 # together as one object in AWS_CONFIGS, so we know they all came "together"
7777 exp = get (AWS_CONFIGS, " expiration" , nothing )
7878 expiration = exp === nothing ? exp : DateTime (rstrip (exp, ' Z' ))
79- Figgy. load! (AWS_CONFIGS, " credentials" =>
79+ Figgy. load! (AWS_CONFIGS, " credentials" =>
8080 AWSCredentials (profile,
8181 get (AWS_CONFIGS, " aws_access_key_id" , " " ),
8282 get (AWS_CONFIGS, " aws_secret_access_key" , " " ),
@@ -237,6 +237,7 @@ const AWS_DEFAULT_REGION = "us-east-1"
237237# "s3.amazonaws.com"
238238# "s3.us-west-2.amazonaws.com"
239239# "bucket.s3.us-west-2.amazonaws.com"
240+ # "bucket.vpce-1a2b3c4d-5e6f.s3.us-east-1.vpce.amazonaws.com"
240241function urlServiceRegion (host)
241242 spl = split (host, ' .' )
242243 if length (spl) == 5 && ! all (isdigit, spl[2 ]) && ! all (isdigit, spl[3 ])
@@ -247,6 +248,10 @@ function urlServiceRegion(host)
247248 elseif length (spl) == 3 && ! all (isdigit, spl[1 ])
248249 # just got service
249250 return (spl[1 ], nothing )
251+ elseif length (spl) == 7 && spl[5 ] == " vpce" && spl[6 ] == " amazonaws" && spl[7 ] == " com"
252+ # See virtual private cloud https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html
253+ # got service & region
254+ return (spl[3 ], spl[4 ])
250255 else
251256 # no service, no region
252257 return (nothing , nothing )
@@ -399,4 +404,4 @@ function awssignv2!(request::HTTP.Request; credentials::Union{Nothing, AWSCreden
399404 request. body = params
400405 end
401406 return
402- end
407+ end
0 commit comments