简体   繁体   English

AWS弹性缓存的云形成

[英]cloud formation for aws elastic cache

I am new to Cloud Formation. 我是云形成的新手。

I have a task to be completed. 我有一个任务要完成。

I want to Read the local instance metadata and look for passed in variables that indicate which S3 bucket, region, Elasticache hostname, etc. 我想读取本地实例元数据,并寻找传入的变量来指示哪个S3存储桶,区域,Elasticache主机名等。

I'm not exactly sure what you mean by "local instance meta data" but I'm going to assume Amazon EC2 instance. 我不确定“本地实例元数据”的含义,但我将假设使用Amazon EC2实例。 I'm going for a stab with two bits of information which might help you get your answer. 我将提供两点信息,这可能会帮助您获得答案。

  1. CloudFormation has built in pseudo parameters which relate to which region the script is running in. This can be used to identify which region you are currently running on. CloudFormation 内置了伪参数 ,这些伪参数与脚本在哪个区域运行有关。可用于标识当前在哪个区域运行。 For example: { "Ref" : "AWS::Region" } 例如: { "Ref" : "AWS::Region" }

  2. Another built in function is GetAZs which allows you to return all the AZs for the region. 另一个内置函数是GetAZ ,它允许您返回该区域的所有AZ。 This can be used to work out which AZs are available in that region. 这可以用来确定该区域中可用的可用区。 For example: {"Fn::GetAZs": {"Ref": "AWS::Region"}} 例如: {"Fn::GetAZs": {"Ref": "AWS::Region"}}

  3. CloudFormation allows you to pass parameters into the script to configure it. CloudFormation允许您将参数传递到脚本中以对其进行配置。 This can be used to configure your script on the fly based on input at the creation of your stack. 这可以用于基于创建堆栈时的输入来动态配置脚本。 These parameters can also be used to modify your stack externally. 这些参数还可以用于在外部修改堆栈。

  4. I'm not sure where you are calling create/update stack from but I'm going to assume Amazon EC2 on the CLI. 我不确定您从哪里调用create / update堆栈,但是我将假定CLI上的Amazon EC2。 Each EC2 instance has its meta data available on a web service at http://169.254.169.254/latest/meta-data/ . 每个EC2实例都有其元数据可通过Web服务http://169.254.169.254/latest/meta-data/ The data returned from this call includes lots of information about the instance, including which AZ and region it is running in. 从该调用返回的数据包括有关实例的大量信息,包括实例在哪个AZ和区域中运行。

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

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