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. phpcms 按价格、按销量、按时间等排序实现思路

    大体思路是在链接中加入指定排序的参数,例如我们使用get中的order作为排序参数: order=views 人气:order=sells 效率:order=pirce 按价格: 那么这三个排序按钮的 ...

  2. DOM的利用冒泡做的一个小程序

    我们都知道DOM的事件流,有冒泡事件,如何有效的利用冒泡? 优化:应该尽量少的添加事件监听:原理:每添加一个事件监听事件,就会在浏览器中添加一个EventListener,如果数量过多,浏览器只能一个 ...

  3. 【JZOJ4924】【NOIP2017提高组模拟12.17】向再见说再见

    题目描述 数据范围 =w= 设h[i]表示,甲队得到i分的方案数. 那么h[(n+k)/2]和h[(n−k)/2]就是答案. 设g[i]表示,甲队得到至少i分的方案数. 那么h[i]=g[i]−∑j& ...

  4. 聊聊jdk http的HeaderFilter

    序 本文主要研究一下jdk http的HeaderFilter. FilterFactory java.net.http/jdk/internal/net/http/FilterFactory.jav ...

  5. js的下拉刷新和上拉加载,基于iScroll v4.2.5

    html部分 <div id="wrapper" style="height: 100%"> <div id="scroller&q ...

  6. vue_qqmapdemo1

    腾讯地图vue组件,实现异步加载腾讯地图,坐标拾取器,支持按城市名称搜索. 搜索框样式依赖elementUI,不需要可删除顶部,地图部分无依赖项 //qqmap.vue <template> ...

  7. SqlSugar 笔记

    分组: 日期分组一: var result = await temp .GroupBy("date_format(Day,'%Y-%m')") .Select(s => ne ...

  8. jQuery 图片跟着鼠标动

    html默认鼠标样式改成图片时格式为 .ani 图片跟随鼠标挪动 html <div id="mouseImg"> <img src="images/问 ...

  9. Spring Boot错误——SpringBoot 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

    背景 使用Spring Cloud搭建微服务,服务的注册与发现(Eureka)项目启动时报错,错误如下 *************************** APPLICATION FAILED T ...

  10. 【NS2】NS2 教學手冊(转载)

    之前做毕设的时候搜索NS2的相关资料,发现这个里面涵盖很广,特此收藏,感谢原作者的辛勤劳作. NS2 教學手冊 ( NS2 Learning Guide) [快速連結區] My works  中文影音 ...