The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

前端 未结 20 1163
既然无缘
既然无缘 2020-11-22 14:19

I get an error AWS::S3::Errors::InvalidRequest The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. when I try upload fi

相关标签:
20条回答
  • 2020-11-22 14:50

    Supernova answer for django/boto3/django-storages worked with me:

    AWS_S3_REGION_NAME = "ap-south-1"

    Or previous to boto3 version 1.4.4:

    AWS_S3_REGION_NAME = "ap-south-1"

    AWS_S3_SIGNATURE_VERSION = "s3v4"

    just add them to your settings.py and change region code accordingly

    you can check aws regions from: enter link description here

    0 讨论(0)
  • 2020-11-22 14:53

    For Boto3 , use this code.

    import boto3
    from botocore.client import Config
    
    
    s3 = boto3.resource('s3',
            aws_access_key_id='xxxxxx',
            aws_secret_access_key='xxxxxx',
            region_name='us-south-1',
            config=Config(signature_version='s3v4')
            )
    
    0 讨论(0)
  • 2020-11-22 14:54

    AWS4-HMAC-SHA256, also known as Signature Version 4, ("V4") is one of two authentication schemes supported by S3.

    All regions support V4, but US-Standard¹, and many -- but not all -- other regions, also support the other, older scheme, Signature Version 2 ("V2").

    According to http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html ... new S3 regions deployed after January, 2014 will only support V4.

    Since Frankfurt was introduced late in 2014, it does not support V2, which is what this error suggests you are using.

    http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html explains how to enable V4 in the various SDKs, assuming you are using an SDK that has that capability.

    I would speculate that some older versions of the SDKs might not support this option, so if the above doesn't help, you may need a newer release of the SDK you are using.


    ¹US Standard is the former name for the S3 regional deployment that is based in the us-east-1 region. Since the time this answer was originally written, "Amazon S3 renamed the US Standard Region to the US East (N. Virginia) Region to be consistent with AWS regional naming conventions." For all practical purposes, it's only a change in naming.

    0 讨论(0)
  • 2020-11-22 14:54

    Try this combination.

    const s3 = new AWS.S3({
      endpoint: 's3-ap-south-1.amazonaws.com',       // Bucket region
      accessKeyId: 'A-----------------U',
      secretAccessKey: 'k------ja----------------soGp',
      Bucket: 'bucket_name',
      useAccelerateEndpoint: true,
      signatureVersion: 'v4',
      region: 'ap-south-1'             // Bucket region
    });
    
    0 讨论(0)
  • 2020-11-22 14:58
    AWS_S3_REGION_NAME = "ap-south-1"
    
    AWS_S3_SIGNATURE_VERSION = "s3v4"
    

    this also saved my time after surfing for 24Hours..

    0 讨论(0)
  • 2020-11-22 15:02

    In Java I had to set a property

    System.setProperty(SDKGlobalConfiguration.ENFORCE_S3_SIGV4_SYSTEM_PROPERTY, "true")
    

    and add the region to the s3Client instance.

    s3Client.setRegion(Region.getRegion(Regions.EU_CENTRAL_1))
    
    0 讨论(0)
提交回复
热议问题