【发布时间】:2019-02-19 01:54:27
【问题描述】:
我正在尝试通过 python fabric3 脚本从本地机器执行 boto3 功能。
在本地机器上配置:
- 安装了python3.5 fabric3
- 使用 fabric3 创建 aws rds 快照的脚本。
- ssh 身份验证存储在
ssh-add ~/.ssh/ec2.pem
aws EC2 实例上的配置:
-
创建 ~/.aws/config 和 ~/.aws/credentials 并存储所需的配置,例如:
a. region=, output in ~/.aws/config aws_access_key_id=, b. aws_secret_access_key in ~/.aws/credentials rds 仅对 ec2 实例开放。
观察:
在从本地机器执行结构脚本时,它要求
botocore.exceptions.NoRegionError: You must specify a region.如果我在 boto3.client(region_name='') 中提供区域名称 它会要求
botocore.exceptions.NoCredentialsError: Unable to locate credentials
表示 python Fabric 不会提取 ~/.aws/config 和 ~/.aws/credentials 文件。
1. python fabric 是否从 ~/.aws 获取凭据和配置?因为我不想通过结构脚本提供凭据
2。在 aws-ec2 上实现基于结构的部署的标准方法是什么
【问题讨论】:
标签: python-3.x amazon-ec2 amazon-rds boto3 fabric