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_keySubstitute 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_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/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_regionSubstitute 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/点击网页右 ...
随机推荐
- 使用HashMap编写一程序实现存储某班级学生信息
1. 使用HashMap编写一程序实现存储某班级学生信息,要求在屏幕上打印如下列表 学号 姓名 性别 年龄 001 张三 男 23 002 李四 男 ...
- 【JZOJ4898】【NOIP2016提高A组集训第17场11.16】人生的价值
题目描述 NiroBC终于找到了人生的意义,可是她已经老了,在新世界,没有人认识她,她孤独地在病榻上回顾着自己平凡的一生,老泪纵横.NiroBC多么渴望再多活一会儿啊! 突然一个戴着黑色方框眼镜,方脸 ...
- springboot(十九)使用actuator监控应用【转】【补】
springboot(十九)使用actuator监控应用 微服务的特点决定了功能模块的部署是分布式的,大部分功能模块都是运行在不同的机器上,彼此通过服务调用进行交互,前后台的业务流会经过很多个微服务的 ...
- Directx11教程(67) 显示模型文件
原文:Directx11教程(67) 显示模型文件 在前面的教程中,我们都是通过在ModelClass中直接产生顶点和索引数据,简单的三角形,立方体等等还好说,毕竟比较简单,如何显示复杂的 ...
- python 正则表达式匹配过程
- JavaScript--查看代码运行效率console.time()与console.timeEnd()用法
程序运行时间计算: <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- 程序跳转到itunes商店
找到应用程序,点击应用程序下面的小三角图标,再选择"复制链接",就可以获取此应用的链接了. 比如: itunes.apple.com/cn/app/bai-du-wen-kuhd/ ...
- 从程序员的角度分析微信小程序
昨天朋友圈被微信小程序刷爆了. 我赶快在书架上拿出三年前买的书,把上面的土擦干净,压压惊. 作为一个并不是资深的程序员. 从程序员的角度分析一下微信小程序,欢迎指点. 首先吐槽 微信小程序只发了200 ...
- hdu1730 尼姆博弈
抽象一下把距离当做石子个数.虽然在这里石子个数可以增加,但是不管怎么增加,不会影响结果,因为你增加了,必须会有减少的. 所以类似取石子,观察平衡状态,如果(x2-x1-1)^...==0,必输. wa ...
- char和achar互转
#pragma once#include "stdafx.h" #ifndef _Convert_H_#define _Convert_H_ //定义转换类class Conver ...