简体   繁体   中英

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.

I'm not exactly sure what you mean by "local instance meta data" but I'm going to assume Amazon EC2 instance. 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. For example: { "Ref" : "AWS::Region" }

  2. Another built in function is GetAZs which allows you to return all the AZs for the region. This can be used to work out which AZs are available in that region. For example: {"Fn::GetAZs": {"Ref": "AWS::Region"}}

  3. CloudFormation allows you to pass parameters into the script to configure it. 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. Each EC2 instance has its meta data available on a web service at 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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