简体   繁体   中英

Error "Access Denied" while uploading file to s3 bucket asp.net core for UploadAsync method

My bucket policy is below. I have shown the information below as HIDDEN.

{
    "Version": "2012-10-17",
    "Id": "****",
    "Statement": [
        {
            "Sid": "<HIDDEN>",
            "Effect": "Allow",
            "Principal": {
                "AWS": "<HIDDEN>"
            },
            "Action": "s3:*",
            "Resource": "<HIDDEN>"
        }
    ]

Your aws credential file is stored in ~/.aws/credentials (on Linux) or "%UserProfile%\\.aws\\credentials" on Windows. By default the .NET SDK will retrieve your credentials from this file default profile.

To set up a default profile, you have to write your access key and secret acces keys in this file as follows:

[default]
aws_access_key_id=YOUR_ACCESS_KEY
aws_secret_access_key=YOUR_SECRET_ACCESS_KEY

See Configuration and Credential File Settings for more details

If you don't have those credentials, you can go to your IAM user in the AWS console and download them as a .csv for example

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