简体   繁体   中英

Provided region_name 'US East (Ohio) us-east-2' doesn't match a supported format

I want to upload a file to amazon CLI it's not working

When I'm uploading manually it's working

I'm using the below command

aws s3 cp /localfolderlocation awss3foldername --recursive --include "filename"

When i try to get list same error

aws s3 ls

The issue was that when running the aws configure CLI command the OP entered the name of the region as seen from the console.

In AWS CLI the region identifier should be the code not the full display name.

The full list of region codes are available here .

This is required for any programmatic interaction with AWS including the SDKs as well.

Check whether you have added the region something like that

AWS_S3_REGION_NAME = 'ca-central-1' in your settings.py file and make sure it should be in small letters.

For my Spring application, after the release of v1.3.1, I had to replace a call to the AWS SDK's Regions.US_EAST_1.getString() with getName() . It didn't like getting US_EAST_1 as part of the request anymore, though it worked before.

@Bean("amazonS3")
  @ConditionalOnProperty(name = "localstack", havingValue = "true")
  @Profile("!test")
  public static AmazonS3 amazonS3LocalStackClient(
      @Value("${s3.endpoint}") String localEndpoint) {
    return AmazonS3ClientBuilder.standard()
        .withCredentials(new DefaultAWSCredentialsProviderChain())
        .withEndpointConfiguration(
            new EndpointConfiguration(localEndpoint, Regions.US_EAST_1.getName()))
        .withPathStyleAccessEnabled(Boolean.TRUE)
        .build();
  }

For me I tried all options,

  1. Deleted env variables
  2. Deleted.aws folder

Nothing worked. Then I just updated the aws cli and rebooted the machine. And it did work. Try below

For windows: msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

For Linux & Mac this is this link

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