AWS Java SDK - Unable to find a region via the region provider chain

后端 未结 7 1975
悲哀的现实
悲哀的现实 2020-12-05 17:17

I have gone through the question titled \"Setting the AWS region programmatically 1\" but it doesn\'t provide all the answers I need.

Q1: I\'m getting a SDKCli

7条回答
  •  青春惊慌失措
    2020-12-05 17:27

    Well steps you can take to investigate:

    Please make sure your Lambda function and S3 are in the same region. (When you use ProviderChain, it will pick up the region from the Lambda function

    Also, You should not need to specify the BasicCredentials(aws-key..etc) if you are using Lambda.

    Please read about Lambda Permission model (http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html):

    Basically, the Lambda role that you assign should have permission to access S3.

    All you need to configure S3 is pretty much:

    private static final AmazonS3 s3Client = 
    AmazonS3ClientBuilder.defaultClient();
    

    To test it locally, make sure you have configured the AWS Credentials locally.

    You can check if you have the credentials, if you go into .aws/credentials (This will contain the "aws-access-key", "aws-secret-key")

    http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html

    To set up your credentials locally, all you need to do is run the AWS Cli command: aws configure (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.htm)

提交回复
热议问题