简体   繁体   English

无法从S3下载文件

[英]Unable to download file from S3

I have an EC2 instance with S3 FullAccess roles attached to it, The instance is in a Public subnet in my VPC. 我有一个带有S3 FullAccess角色的EC2实例,该实例位于我的VPC中的Public子网中。

I have installed AWS CLI on the EC2 instance using the following commands - 我已使用以下命令在EC2实例上安装了AWS CLI-

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

I verified the AWS CLI installation using the following command - 我使用以下命令验证了AWS CLI的安装 -

$ aws help

I could list the S3 Buckets using the following command - 我可以使用以下命令列出S3存储桶-

$ aws s3 ls

I have a file uploaded on S3 inside a prefix location, I tried to download it using the following command - 我在S3上的前缀位置上传了一个文件,我尝试使用以下命令下载该文件-

aws s3api get-object --bucket demoBucketName --key demoFolder/demoFile.php demoFile.php

I got the following error for the above command - 我收到上述命令的以下错误- 在此处输入图片说明

I also tried with - 我也尝试过-

aws s3 cp s3://demoBucketName/demoFolder/demoFile.php demoFile.php

Got this error for the 2nd command - 在第二个命令中遇到此错误- 在此处输入图片说明

aws s3api get-bucket-location --bucket BUCKET

假设以上命令的输出为us-west-2

aws s3api get-object --bucket demoBucketName --key --region us-west-2 demoFolder/demoFile.php demoFile.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM