I am writing my first AWS Cloudformation template in Yaml. I am trying to figure out if it is possible to specify the number of instances created by an Autoscaling group based on two separate parameter inputs.
Example: User enters the volume of data indexed in GB from 1 to 3072 and it is saved as "data volume" parameter. Then the user enters the number of users of the network up to and it is saved as "usernumber". I then want to used to tell the ASG how many instances to create. So if there are 16 users and 2gb of data volume I want 2 instances and if there are 48 users and 500gb of data volume i want 10 instances and so on up to 21 instances.
Is something like this possible? Or am I stuck with only being able to allow the user to enter the number that they want as a single parameter?
Thanks for any help.
Is something like this possible?
You could probably create a number of conditions in CFN , to account for all possible combinations . If you have only few allowed combinations, its should be doable.
For anything more complex, you need custom resource . The resource would be in the form of a lambda function which could do any calculatons on your parameters and and launch your instance using AWS SDK.
Here is an example of what I am trying to write
Create2Indexer: !And - !Equals - !Ref 'NumberofUsers' - <= '8' - !Equals - !Ref 'DailyIndexVolume' - '>=300' - !Equals - !Ref 'DailyIndexVolume' - < '600' !OR !AND - !Equals - !Ref 'NumberofUsers' - > '16' - !Equals - !Ref 'DailyIndexVolume' - < '300'
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.