AWS Cloudformation输出

时间:2015-05-25 16:31:32

标签: amazon-web-services amazon-cloudformation

我正在为用户创建一个CloudFormation模板,该模板将创建实例并提供应用程序端点和用户名和密码。我能够实现与实例ID相关的唯一应用程序端点,但我无法生成动态用户名。任何人都可以帮助在每次新尝试时使用该函数来实现不同的用户名。以下是样本。

"Outputs" : {
"EndpointURL" : { 
  "Description" : "Application End Point",
  "Value" :  { "Fn::Join" : [ "", [ "http://", { "Ref" : "DNS****"}]]}
  },
  "Username" : {
   "Description" : "Dynamic Username required",
   "Value" :  "**********.com"
  },    
  "Password" : {
   "Description" : "Password",
   "Value" :  "Fixed"
  }
}

}

2 个答案:

答案 0 :(得分:0)

您可以使用Custom Resources创建CloudFormation本身不支持的任何内容。在您的情况下,生成随机用户名,可能可以使用Lambda Custom Resources实现。

也可以启动一个计算任何所需内容的实例,但我会考虑使用lambda自定义资源,因为这是自定义CloudFormation的最简单方法。

答案 1 :(得分:0)

I wouldn't recommend using your approach.

Please review your application architecture. If you're looking into getting DNS records for your instances, you need to register those instances with Route 53 records from withing the instances themselves.

If you really need to generate usernames and access credentials, I'd use IAM resources from within CloudFormation.