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/credentials
on Linux, macOS, or UnixC:\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
andAWS_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
- export AWS_ACCESS_KEY_ID=your_access_key_id
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 UnixC:\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 使用的更多相关文章
- 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/点击网页右 ...
随机推荐
- NOIP模拟 17.8.14
NOIP模拟17.8.14 (天宇哥哥考察细心程度的题) [样例解释]如果删去第一个 1:在[3,1,2]中有 3 个不同的数如果删去 3:在[1,1,2]中有 2 个不同的数如果删去第二个 1:在[ ...
- 【水滴石穿】FirstReactNativeProject
这个是一个小demo,项目地址为https://github.com/prsioner/FirstReactNativeProject 有注册,忘记密码还有登陆,应该是用到了react-navigat ...
- TCP/IP协议学习
计算机网路学得不好,首先先放个OSI七层网络模型吧 在协议的控制下,上层对下层进行调用,下层对上层进行服务, 上下层间用交换原语交换信息.这样可以提高传输速率,并且保证数据安全,所以说其实每一层都有存 ...
- 【python小随笔】进程池 multiprocessing.Pool的简单实现与踩过的坑
#导入进程模块 import multiprocessing #创建进程池 坑:一定要在循环外面创建进程池,不然会一直创建 pool = multiprocessing.Pool(30) for Si ...
- day39-Spring 12-Spring的JDBC模板:快速入门
Spring AOP的关键是它的底层的原理和思想,配置和使用并不是十分困难.AOP本身就是一个思想,是面向对象的延伸,不是用来替换面向对象的,而是用来解决面向对象中的一些问题的.在最初的时候提出过一个 ...
- 阿里云容器Kubernetes监控(九) - Kubernetes事件离线工具kube-eventer正式开源
前言 监控是保障系统稳定性的重要组成部分,在Kubernetes开源生态中,资源类的监控工具与组件百花齐放.除了社区自己孵化的metrics-server,还有从CNCF毕业的Prometheus等等 ...
- Balanced Binary Tree 判断平衡二叉树
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...
- sql —— in
IN 操作符允许我们在 WHERE 子句中规定多个值. 原表: 执行查询:
- spring调试
spring-beans DefaultListableBeanFactory preInstantiateSingletons:650 RequestMappingHandlerMapping Ab ...
- C++返回值优化
返回值优化(Return Value Optimization,简称RVO)是一种编译器优化机制:当函数需要返回一个对象的时候,如果自己创建一个临时对象用于返回,那么这个临时对象会消耗一个构造函数(C ...