zoukankan      html  css  js  c++  java
  • Boto Config File

    BotoAWS SDK for Python,可以通过pip安装,也可以下载源码直接安装。直接安装挺方便的。

    安装后参照AWS给出的Sample Project,连接S3,遍历一下buckets,获取指定的bucket,都挺简单的。

    但是忘记了做一件事,没有“export access keys to environment variables”。模仿Sample只能把access key ID和secret access key作为参数写在代码里。

    回过头看文档,再找到Boto Config的文档,然后就傻乎乎地试图去找到文档里提到的"boto.cfg"和".boto",折腾半天没找到。

    浪费不少时间之后才明白,boto installer是不会自动创建这个config文件的。手动创建一个,放到该放的地方就可以了。

    哪些地方是该放的地方呢?Unix/Linux系统里,boto按照这个顺序寻找config文件。

    • /etc/boto.cfg - for site-wide settings that all users on this machine will use
    • ~/.boto - for user-specific settings
    • ~/.aws/credentials - for credentials shared between SDKs

    当然,这也不是必须的,可以把config文件放到任何地方,然后在环境变量里配置BOTO_CONFIG。如果是Windows系统咋办?Stackoverflow上这个问题的回答可行。

    • Create your file with the name you want(e.g boto_config.cfg) and place it in a location of your choice
    • Create an environment variable with the Name='BOTO_CONFIG' and Value= file_location/file_name
    • Boto is now ready to work with credentials automatically configured!

    当然,最权威的是仔细看Boto Config文档,这里也介绍了在config文件里如何配置Credentials。

  • 相关阅读:
    Spring AOP Capabilities and Goal
    CDI Features
    Java Design Patterns
    Connector for python
    Spring reference
    a+1、&a+1、*(a+1)、*(&a+1)、*(*(&a+1))的区别
    int **p和int *p
    Hibernate注解
    功能测试
    零售商商品管理系统代码节选
  • 原文地址:https://www.cnblogs.com/loveisbug/p/3761334.html
Copyright © 2011-2022 走看看