Boto3 Error: botocore.exceptions.NoCredentialsError: Unable to locate credentials

后端 未结 12 2243
逝去的感伤
逝去的感伤 2020-11-30 23:00

When I simply run the following code, I always gets this error.

s3 = boto3.resource(\'s3\')
    bucket_name = \"python-sdk-sample-%s\" % uuid.uuid4()
    pri         


        
12条回答
  •  伪装坚强ぢ
    2020-11-30 23:47

    from the terminal type:-

    aws configure
    

    then fill in your keys and region.

    after this do next step use any environment. You can have multiple keys depending your account. Can manage multiple enviroment or keys

    import boto3
    aws_session = boto3.Session(profile_name="prod")
    # Create an S3 client
    s3 = aws_session.client('s3')
    

提交回复
热议问题