AWS的文档系统真是烂到家了!!!!!

To connect to any of the supported services with the AWS SDK for Java, you must provide AWS credentials. The AWS SDKs and CLIs use provider chains to look for AWS credentials in a number of different places, including system/user environment variables and local AWS configuration files.

This topic provides basic information about setting up your AWS credentials for local application development using the AWS SDK for Java. If you need to set up credentials for use within an EC2 instance or if you're using the Eclipse IDE for development, refer to the following topics instead:

Setting AWS Credentials#

Setting your credentials for use by the AWS SDK for Java can be done in a number of ways, but here are the recommended approaches:

  • Set credentials in the AWS credentials profile file on your local system, located at:

    • ~/.aws/credentials on Linux, macOS, or Unix
    • C:\Users\USERNAME\.aws\credentials on Windows

    This file should contain lines in the following format:

    [default]
    aws_access_key_id = your_access_key_id
    aws_secret_access_key = your_secret_access_key

    Substitute your own AWS credentials values for the values your_access_key_id andyour_secret_access_key.

  • Set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

    To set these variables on Linux, macOS, or Unix, use export:

    export AWS_ACCESS_KEY_ID=your_access_key_id
    export AWS_SECRET_ACCESS_KEY=your_secret_access_key

    To set these variables on Windows, use set:

    set AWS_ACCESS_KEY_ID=your_access_key_id
    set AWS_SECRET_ACCESS_KEY=your_secret_access_key
  • For an EC2 instance, specify an IAM role and then give your EC2 instance access to that role. See IAM Roles for Amazon EC2 in the Amazon EC2 User Guide for Linux Instances for a detailed discussion about how this works.

Once you have set your AWS credentials using one of these methods, they will be loaded automatically by the AWS SDK for Java by using the default credential provider chain. For further information about working with AWS credentials in your Java applications, see Working with AWS Credentials.

Setting the AWS Region#

You should set a default AWS Region that will be used for accessing AWS services with the AWS SDK for Java. For the best network performance, you should choose a region that's geographically close to you (or to your customers).

Note

If you don't select a region, then us-east-1 will be used by default.

You can use similar techniques to setting credentials to set your default AWS region:

  • Set the AWS region in the AWS config file on your local system, located at:

    • ~/.aws/config on Linux, macOS, or Unix
    • C:\Users\USERNAME\.aws\config on Windows

    This file should contain lines in the following format:

    [default]
    region = your_aws_region

    Substitute your desired AWS region (for example, "us-west-2") for your_aws_region.

  • Set the AWS_REGION environment variable.

    On Linux, macOS, or Unix, use export:

    export AWS_REGION=your_aws_region
    

    On Windows, use set:

    set AWS_REGION=your_aws_region
    

    Where your_aws_region is the desired AWS region name.

AWS Credentials 使用的更多相关文章

  1. AWS CLI使用s3

    aws CLI是什么东西,暂且先不去了解,目前的需求是s3. 我在Jenkins上创建一个bucket,然后申请access_key,然后就可以使用s3来存储数据了.也就是说,s3就是一个网盘. 1. ...

  2. 基于AWS的云服务架构最佳实践

    ZZ from: http://blog.csdn.net/wireless_com/article/details/43305701 近年来,对于打造高度可扩展的应用程序,软件架构师们挖掘了若干相关 ...

  3. AWS 命令行界面 + Python 的 AWS 开发工具包 (Boto3)

    安装AWS CLI $ pip install awscli 安装Boto3 $ pip install boto3 设置AWS CLI $ aws configure AWS Access Key ...

  4. AWS Step Function Serverless Applications

    Installing VS Components To follow along with this article, you must have an AWS account and install ...

  5. Azure Function & AWS Function With C#

    Using C# with Azure Functions Two important prerequisites need to be met to build Azure Functions ap ...

  6. boto3--通过Python的SDK连接aws

    通过Python的SDK连接aws 参考: https://aws.amazon.com/cn/developers/getting-started/python/ aws上生成访问密钥 ID 和私有 ...

  7. Amazon AWS S3 操作手册

    Install the SDK The recommended way to use the AWS SDK for Java in your project is to consume it fro ...

  8. 用Node完成AWS S3的Upload流程之全世界最简版

    开场: 查了两天文档,Error了38次,最后索性去掉所有附加条件, 连界面也不要了,在命令行里跑通了一坨最干瘪的Upload流程! 还冒着热气…… 在此先做记录,明天可以搭配美美的界面继续调试了. ...

  9. Java通过aws java sdk在AWS S3上进行操作客户端

    有两种方式可以安装aws java sdk:方式一:可以在这个网站上下载适用于 Java 的 AWS 开发工具包https://aws.amazon.com/cn/sdk-for-java/点击网页右 ...

随机推荐

  1. mysql中的year(date)和date_format(date,format)的用法

    执行:select SYSDATE() from dual; 返回:2017-10-24 13:48:06 执行:select DATE_FORMAT(SYSDATE(),'%Y.%m.%d') fr ...

  2. oracle dbms_repcat_admin能带来什么安全隐患

    如果一个用户能执行dbms_repcat_admin包,将获得极大的系统权限. 以下情况可能获得该包的执行权限: 1.在sys下grant execute on dbms_repcat_admin t ...

  3. vue @click.native

    1,给vue组件绑定事件时候,必须加上native ,不然不会生效(监听根元素的原生事件,使用 .native 修饰符) 2,等同于在自组件中: 子组件内部处理click事件然后向外发送click事件 ...

  4. Laravel 登录后清空COOKIE 方法

    需求 在Laravel 登陆立即清空保存的COOKIE数组 实现 # Http/Controllers/Auth/LoginController.php public function redirec ...

  5. linux CentOs 7.4 64位 系统下 nuxt部署 、nginx 安装、node环境及软连接,pm2软连接

    一.nginx安装 1.安装依赖包 //一键安装上面四个依赖 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 2 ...

  6. 设置onselectstart在ie浏览器下对于input及textarea标签页会生效

    设置onselectstart在ie浏览器下对于input及textarea标签页会生效, 可以使用js来控制对于某种标签不生效,代码如下: document.onselectstart = disa ...

  7. ansible基础☞安装方法

    一 需要安装些什么 Ansible默认通过 SSH 协议管理机器. 安装Ansible之后,不需要启动或运行一个后台进程,或是添加一个数据库.只要在一台电脑(可以是一台笔记本)上安装好,就可以通过这台 ...

  8. myeclipse 如何更改java jsp 等文件的编码方式

    java的编码方式: 1.window——>preference 2.General——>Workspace,右边[Text file encoding]选择编码后,点击[OK]. jsp ...

  9. Linxu 用户和用户组管理1

    Linux 系统是一个多用户任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后 以这个账号的身份进入系统. 用户的账号一方面可以帮助系统管理员对使用系统的用户进 ...

  10. Python中进制转换函数的使用

    Python中进制转换函数的使用 关于Python中几个进制转换的函数使用方法,做一个简单的使用方法的介绍,我们常用的进制转换函数常用的就是int()(其他进制转换到十进制).bin()(十进制转换到 ...