简体   繁体   English

AWS实例distcp到s3 - 访问密钥

[英]AWS instance distcp to s3 - Access keys

If I have an EC2 instance created with a role, what is the best practice way to get access keys to do a distcp from hdfs to s3? 如果我有一个使用角色创建的EC2实例,那么从hdfs到s3获取访问密钥以执行distcp的最佳实践方法是什么?

I don't want to be sending access keys to the instance using our automated deployment tools because that would mean storing the keys in plain sight. 我不想使用我们的自动部署工具向实例发送访问密钥,因为这意味着将密钥存储在视线中。 Is there a way for the instance to request a set of keys using the CLI? 有没有办法让实例使用CLI请求一组密钥?

I need to have them for hadoop distcp /data s3n://<access_key>:<secret_key>@mybucket/baackup/data 我需要将它们用于hadoop distcp /data s3n://<access_key>:<secret_key>@mybucket/baackup/data

When an Amazon EC2 instance is launched with a Role, then the instance is given access to temporary security keys via the Instance Metadata Service. 当使用角色启动Amazon EC2实例时,实例将通过Instance元数据服务授予对临时安全密钥的访问权限。 It works as follows: 它的工作原理如下:

  • A Role is created in Identity and Access Management (IAM) 在身份和访问管理(IAM)中创建角色
  • Appropriate permissions are granted to the role 为角色授予适当的权限
  • An Amazon EC2 instance is launched with that Role selected. 启动 Amazon EC2实例并选择该角色。 If you are using Amazon Elastic MapReduce (EMR) to launch the instances, then they are typically assigned an EMR-specific role (which you can modify 如果您使用Amazon Elastic MapReduce(EMR)来启动实例,那么通常会为它们分配一个特定于EMR的角色(您可以修改它)
  • A set of temporary security credentials are made available to the instance via the URL http://169.254.169.254/latest/meta-data/iam/security-credentials/ 通过URL http://169.254.169.254/latest/meta-data/iam/security-credentials/为实例提供一组临时安全证书。

Software that calls the AWS SDK knows to automatically look at this URL to retrieve security credentials. 调用AWS SDK的软件知道自动查看此URL以检索安全凭据。 If the software you are using does not automatically look at this URL, you can extract them and pass them to the software. 如果您使用的软件没有自动查看此URL,您可以提取它们并将它们传递给软件。

See: Retrieving Security Credentials from Instance Metadata 请参阅: 从实例元数据中检索安全凭据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM