通过 CloudFormation 声明 IAM 访问密钥资源 [英] Declaring an IAM Access Key Resource by CloudFormation

查看:26
本文介绍了通过 CloudFormation 声明 IAM 访问密钥资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在模板中使用访问密钥创建了一个用户:

I created a user in my template with an access key:

"MyAccessKey" : {
   "Type" : "AWS::IAM::AccessKey",
   "Properties" : {
      "UserName" : { "Ref" : "User12" }
   }
} 

我需要在模板的输出中获取访问密钥 ID 和密钥.怎么做 ?谢谢

I need to get the access key ID and the secret key in the output of the template. How to do that ? Thank you

推荐答案

访问密钥 ID 和秘密密钥可作为 返回值 AWS::IAM::AccessKey资源:

The access key id and the secret key are available as return values for the AWS::IAM::AccessKey resource:

"Outputs" : {
  "MyAccessKeyId": {
    "Ref" : "MyAccessKey"
  },
  "MySecretKey": {
    "Fn::GetAtt": [ "MyAccessKey", "SecretAccessKey" ]
  }
}

这篇关于通过 CloudFormation 声明 IAM 访问密钥资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆