-
I'm trying to use $ aws s3 ls mybucket --profile ovh --endpoint-url https://storage.gra.cloud.ovh.net/
2022-09-06 15:19:09 992388 foo.jpg The following Ruby script returns a require 'aws-sdk-s3'
options = {}
options[:access_key_id] = "SNIP"
options[:secret_access_key] = "SNIP"
options[:endpoint] = "https://storage.gra.cloud.ovh.net"
options[:region] = "gra"
s3_client = Aws::S3::Client.new(options)
@s3 = Aws::S3::Resource.new(client: s3_client)
@bucket = @s3.bucket('mybucket')
print('exists?', @bucket.exists?) I'm an When debugging and stepping through, I was mildly surprised to see the Host header: I'm not sure how subdomain aspects are supposed to work, but it seems mildly sus. Contents of ~/.aws/*
aws-sdk-ruby v1.114.0 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Yes, in theory those are supported but those use cases are not well understood or tested from our side admittedly. It is correct that the S3 bucket should be prepended to the URL as a subdomain (it's called a virtual host style). This is S3's preferred style. Buckets that aren't DNS compliant are in the URL path. I am thinking that your custom endpoint expects path style, such as /bucket/key, and I also believe this to be a difference in default behavior between the CLI and most of the SDKs. Try configuring either |
Beta Was this translation helpful? Give feedback.
-
TIL about (I also just saw Jeff's post which provides more context.) Happily, when I include
|
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Yes, in theory those are supported but those use cases are not well understood or tested from our side admittedly. It is correct that the S3 bucket should be prepended to the URL as a subdomain (it's called a virtual host style). This is S3's preferred style. Buckets that aren't DNS compliant are in the URL path. I am thinking that your custom endpoint expects path style, such as /bucket/key, and I also believe this to be a difference in default behavior between the CLI and most of the SDKs. Try configuring either
force_path_style: true
(preferred) ordisable_host_prefix_injection: true
on your S3 client and it should not prepend.