How to Generate a Presigned S3 URL via AWS CLI

前端 未结 5 1343
误落风尘
误落风尘 2021-02-01 04:15

Is there a way to create presigned URL for objects in S3 bucket using AWS CLI?

I know that could be done using SDK, but is it possible with CLI?

I found this on

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 05:02

    @Michael and @Shabbir,

    Yes, aws s3 presign does not accept globbing/wildcards/, --include, --exclude, or --recursive'. awslsdoes not accept-1; it behaves asls -lporls -lph`.

    a loop works:

    for file in $(aws s3 ls s3://mybucket --profile myprofile \
    --endpoint-url  | awk '{print $NF}'); do
        aws s3 presign --expires-in 300 "s3://mybucket/$file" |
        --profile my-profile --endpoint-url 
    done
    

提交回复
热议问题