Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering AWS CloudFormation

You're reading from   Mastering AWS CloudFormation Plan, develop, and deploy your cloud infrastructure effectively using AWS CloudFormation

Arrow left icon
Product type Paperback
Published in May 2020
Publisher Packt
ISBN-13 9781789130935
Length 300 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Karen Tovmasyan Karen Tovmasyan
Author Profile Icon Karen Tovmasyan
Karen Tovmasyan
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: CloudFormation Internals
2. CloudFormation Refresher FREE CHAPTER 3. Advanced Template Development 4. Section 2: Provisioning and Deployment at Scale
5. Validation, Linting, and Deployment of the Stack 6. Continuous Integration and Deployment 7. Deploying to Multiple Regions and Accounts Using StackSets 8. Configuration Management of the EC2 Instances Using cfn-init 9. Section 3: Extending CloudFormation
10. Creating Resources outside AWS Using Custom Resources 11. Dynamically Rendering the Template Using Template Macros 12. Generating CloudFormation Templates Using AWS CDK 13. Deploying Serverless Applications Using AWS SAM 14. What's Next? 15. Assessments 16. Other Books You May Enjoy

Using conditional elements

We want to have reusable templates, but sometimes we need to create a resource in one case and don't need to create one in another, or perhaps create one with different attributes.

Conditions are handy to solve that kind of problem, and can be used in two ways: to specify the Condition under the resource or to use the conditional intrinsic function in the resource properties.

We already know that Condition is a strict Boolean variable, which is evaluated by parameters and conditional functions. We have already learned how conditions are used in resource declaration (jump to the Going through the internals of the template section if you need a refresher), so let's look at another useful example.

Say that we have an AutoScaling group that is built from a launch template. We expect to have a different load on test and production, so we want to adjust the size of the EC2 instance accordingly. For now, we are happy with t3.micro on test and...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime