简体   繁体   中英

How to upload a file to S3 as a Cognito user by using aws-cli?

I got an 403 error when I tried to upload to S3 with Amplify.js and I can't figure out why...

So I'd like to see if I get the same 403 error with aws-cli, but I don't know how to upload a file as a Cognito user by using aws-cli.

Anyone know how to do this?

Something to check: Cognito user profile has the right permissions to upload to the S3 bucket. This has tripped me up before. "was s3 cp" is what you are looking for.

aws s3 cp <local_file_path> s3://<bucket_name>/<s3_object_key> --profile <cognito_user_profile>

Docs: https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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