boto3 client NoRegionError: You must specify a region error only sometimes

后端 未结 7 1716
误落风尘
误落风尘 2021-01-30 07:30

I have a boto3 client :

boto3.client(\'kms\')

But it happens on new machines, They open and close dynamically.

    if endpoint         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 08:26

    Alternatively you can run the following (aws cli)

    aws configure --profile $PROFILE_NAME
    

    it'll prompt you for the region.

    notice in ~/.aws/config it's:

    [default]
    region = ap-southeast-1
    output = json
    
    [profile prod]
    region = ap-southeast-1
    output = json
    

    [profile profile name] in the square brackets

提交回复
热议问题