AWS Service Catalog
Administrator Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Step 5: Add a Template Constraint to Limit Instance Size

Constraints add another layer of control over products at the portfolio level. Constraints can control the launch context of a product (launch constraints), or add rules to the AWS CloudFormation template (template constraints). For more information, see Using AWS Service Catalog Constraints.

Now add a template constraint to the Linux Desktop product that prevents users from selecting large instance types at launch time. The development-environment template allows the user to select from six instance types; this constraint limits valid instance types to the two smallest types, t2.micro and t2.small. For more information, see T2 Instances in the Amazon EC2 User Guide for Linux Instances.

To add a template constraint to the Linux Desktop product

  1. On the portfolio details page, expand the Constraints section, and choose Add constraints.

  2. In the Select product and type window, for Product, choose Linux Desktop. Then, for Constraint type, choose Template.

  3. Choose Continue.

  4. For Description, type Small instance sizes.

  5. Paste the following into the Template constraint text box:

    { "Rules": { "Rule1": { "Assertions": [ { "Assert" : {"Fn::Contains": [["t2.micro", "t2.small"], {"Ref": "InstanceType"}]}, "AssertDescription": "Instance type should be t2.micro or t2.small" } ] } } }
  6. Choose Submit.