无法从 S3 复制到 Ec2 实例
Unable to copy from S3 to Ec2 instance
我正在尝试将文件从 S3 复制到 Ec2 实例,这是奇怪的行为
以下命令运行得非常好,并向我展示了我想要访问的 s3 的内容
$aws s3 ls
2016-05-05 07:40:57 folder1
2016-05-07 15:04:42 my-folder
然后我发出以下命令(也成功)
$ aws s3 ls s3://my-folder
2016-05-07 16:44:50 6007 myfile.txt
但是当我尝试复制这个文件时,我收到如下错误
$aws s3 cp s3://my-folder/myfile.txt ./
A region must be specified --region or specifying the region in a
configuration file or as an environment variable. Alternately, an
endpoint can be specified with --endpoint-url
我只想将 txt 文件从 s3 复制到 ec2 实例。
至少修改上面的命令来复制内容。我不确定区域,因为如果我从网络访问 S3,它会显示
"S3 does not require region selection"
地球上发生了什么?
很可能有些地方工作不正常,如果您的区域没有在 aws configure 中设置为默认区域,您应该无法列出存储桶。
因此,根据我使用 S3 的经验,如果这有效:
aws s3 ls s3://my-folder
那么这也应该有效:
aws s3 cp s3://my-folder/myfile.txt ./
但是,如果它要求您提供区域,那么您需要提供它。
试试这个来获取桶区域:
aws s3api get-bucket-location --bucket BUCKET
然后复制文件:
aws s3 cp --region <your_buckets_region> s3://my-folder/myfile.txt ./
If I visit S3 from web it says
"S3 does not require region selection"
S3 和桶区域可能会非常混乱,尤其是对于该消息。因为在涉及 s3 区域时,这是 IMO 有史以来最具误导性的信息。每个桶都有特定的区域(默认是 us-east-1),除非你启用了 cross-region replication。
You can choose a region to optimize latency, minimize costs, or
address regulatory requirements. Objects stored in a region never
leave that region unless you explicitly transfer them to another
region. For more information about regions, see Accessing a Bucket: in
the Amazon Simple Storage Service Developer Guide.
怎么样
aws s3 cp s3://my-folder/myfile.txt .
# or
aws s3 cp s3://my-folder/myfile.txt myfile.txt
我怀疑问题与本地路径解析器有关。
aws cli s3 fileformat parser
这有点奇怪,因为 aws cli 读取了凭证和区域配置。
修复是指定区域,下面解释了如果您无法从 cli 获取存储桶区域,如何获取它。
aws s3 cp s3://xxxxyyyyy/2008-Nissan-Sentra.pdf myfile.pdf --region us-west-2
我正在尝试将文件从 S3 复制到 Ec2 实例,这是奇怪的行为 以下命令运行得非常好,并向我展示了我想要访问的 s3 的内容
$aws s3 ls
2016-05-05 07:40:57 folder1
2016-05-07 15:04:42 my-folder
然后我发出以下命令(也成功)
$ aws s3 ls s3://my-folder
2016-05-07 16:44:50 6007 myfile.txt
但是当我尝试复制这个文件时,我收到如下错误
$aws s3 cp s3://my-folder/myfile.txt ./
A region must be specified --region or specifying the region in a configuration file or as an environment variable. Alternately, an endpoint can be specified with --endpoint-url
我只想将 txt 文件从 s3 复制到 ec2 实例。 至少修改上面的命令来复制内容。我不确定区域,因为如果我从网络访问 S3,它会显示
"S3 does not require region selection"
地球上发生了什么?
很可能有些地方工作不正常,如果您的区域没有在 aws configure 中设置为默认区域,您应该无法列出存储桶。
因此,根据我使用 S3 的经验,如果这有效:
aws s3 ls s3://my-folder
那么这也应该有效:
aws s3 cp s3://my-folder/myfile.txt ./
但是,如果它要求您提供区域,那么您需要提供它。
试试这个来获取桶区域:
aws s3api get-bucket-location --bucket BUCKET
然后复制文件:
aws s3 cp --region <your_buckets_region> s3://my-folder/myfile.txt ./
If I visit S3 from web it says
"S3 does not require region selection"
S3 和桶区域可能会非常混乱,尤其是对于该消息。因为在涉及 s3 区域时,这是 IMO 有史以来最具误导性的信息。每个桶都有特定的区域(默认是 us-east-1),除非你启用了 cross-region replication。
You can choose a region to optimize latency, minimize costs, or address regulatory requirements. Objects stored in a region never leave that region unless you explicitly transfer them to another region. For more information about regions, see Accessing a Bucket: in the Amazon Simple Storage Service Developer Guide.
怎么样
aws s3 cp s3://my-folder/myfile.txt .
# or
aws s3 cp s3://my-folder/myfile.txt myfile.txt
我怀疑问题与本地路径解析器有关。 aws cli s3 fileformat parser
这有点奇怪,因为 aws cli 读取了凭证和区域配置。
修复是指定区域,下面解释了如果您无法从 cli 获取存储桶区域,如何获取它。
aws s3 cp s3://xxxxyyyyy/2008-Nissan-Sentra.pdf myfile.pdf --region us-west-2