AWS Credentials 使用
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:
- When using an EC2 instance, create an IAM role and then give your EC2 instance access to that role as shown in Using IAM Roles to Grant Access to AWS Resources on Amazon EC2.
- Set up AWS credentials within Eclipse using the AWS Toolkit for Eclipse. See Set up AWS Credentials in theAWS Toolkit for Eclipse User Guide for more information.
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/credentialson Linux, macOS, or UnixC:\Users\USERNAME\.aws\credentialson 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_keySubstitute your own AWS credentials values for the values your_access_key_id andyour_secret_access_key.
Set the
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYenvironment 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_keyTo set these variables on Windows, use set:
set AWS_ACCESS_KEY_ID=your_access_key_id
set AWS_SECRET_ACCESS_KEY=your_secret_access_keyFor 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/configon Linux, macOS, or UnixC:\Users\USERNAME\.aws\configon Windows
This file should contain lines in the following format:
[default]
region = your_aws_regionSubstitute your desired AWS region (for example, "us-west-2") for your_aws_region.
Set the
AWS_REGIONenvironment 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 使用的更多相关文章
- AWS CLI使用s3
aws CLI是什么东西,暂且先不去了解,目前的需求是s3. 我在Jenkins上创建一个bucket,然后申请access_key,然后就可以使用s3来存储数据了.也就是说,s3就是一个网盘. 1. ...
- 基于AWS的云服务架构最佳实践
ZZ from: http://blog.csdn.net/wireless_com/article/details/43305701 近年来,对于打造高度可扩展的应用程序,软件架构师们挖掘了若干相关 ...
- AWS 命令行界面 + Python 的 AWS 开发工具包 (Boto3)
安装AWS CLI $ pip install awscli 安装Boto3 $ pip install boto3 设置AWS CLI $ aws configure AWS Access Key ...
- AWS Step Function Serverless Applications
Installing VS Components To follow along with this article, you must have an AWS account and install ...
- Azure Function & AWS Function With C#
Using C# with Azure Functions Two important prerequisites need to be met to build Azure Functions ap ...
- boto3--通过Python的SDK连接aws
通过Python的SDK连接aws 参考: https://aws.amazon.com/cn/developers/getting-started/python/ aws上生成访问密钥 ID 和私有 ...
- Amazon AWS S3 操作手册
Install the SDK The recommended way to use the AWS SDK for Java in your project is to consume it fro ...
- 用Node完成AWS S3的Upload流程之全世界最简版
开场: 查了两天文档,Error了38次,最后索性去掉所有附加条件, 连界面也不要了,在命令行里跑通了一坨最干瘪的Upload流程! 还冒着热气…… 在此先做记录,明天可以搭配美美的界面继续调试了. ...
- Java通过aws java sdk在AWS S3上进行操作客户端
有两种方式可以安装aws java sdk:方式一:可以在这个网站上下载适用于 Java 的 AWS 开发工具包https://aws.amazon.com/cn/sdk-for-java/点击网页右 ...
随机推荐
- Path Sum II深度优先找路径
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...
- ELK之java虚拟机安装1
建议:直接按照默认路径,下面有一个路径我有点小改动 java最新版本1.12 从官网上下载oracle官网上的jdk 1.双击这个jdk.exe 2.点击"是" 3.点击下图的&q ...
- IOS 后台挂起程序 当程序到后台后,继续完成Long-Running Task 任务
我们知道,到我们程序从前台退到后台(安home)键后,将执行程序的委托方法. // 当应用程序掉到后台时,执行该方法 - (void)applicationDidEnterBackground:(UI ...
- oracle审计实施
1.语句审计 Audit session; Audit session By ; 与instance连接的每个会话生成一条审计记录.审计记录将在连接时期插入并且在断开连接时期进行更新. 保留有关会话 ...
- Leetcode728.Self Dividing Numbers自除数
自除数 是指可以被它包含的每一位数除尽的数. 例如,128 是一个自除数,因为 128 % 1 == 0,128 % 2 == 0,128 % 8 == 0. 还有,自除数不允许包含 0 . 给定上边 ...
- PHPCMS快速建站系列
模板标签 {pc:content action="position" posid="2" order="id DESC" num=&qu ...
- android performance
https://developer.android.com/studio/profile/systrace.html http://www.milan100.com/article/show/1544 ...
- 快速启动Oracle服务
快速启动Oracle服务的批处理命令步骤 新建记事本 粘贴如下内容: @echo off echo 确定要启动Oracle 11g服务吗? pause net start OracleOraDb11g ...
- C++模板编译模型
一:传统的编译模型 使用C/C++进行编程时,一般会使用头文件以使定义和声明分离,并使得程序以模块方式组织.将函数声明.类的定义放在头文件中,而将函数实现以及类成员函数的定义放在独立的文件中. 但是对 ...
- qt 自定义窗口绘制正弦曲线
circlewidget.h #ifndef CIRCLAWIDGET_H #define CIRCLAWIDGET_H #include <QFrame> #include<QVe ...