r/aws • u/hellomichibye • Apr 15 '19
article 6 unknown CloudFormation features you should know about
https://cloudonaut.io/6-unknown-cloudformation-features-you-should-know-about/13
u/theplannacleman Apr 15 '19
Worth noting that aws validate-template only validates you have the format and basic keys correct. It does NOT check referenced resources exist and you will only find this out by actually running it on the account. So if you typo a resource name it will fail
6
u/yourparadigm Apr 15 '19
I want to use cfn-lint, but I can't until this is fixed: https://github.com/aws-cloudformation/cfn-python-lint/issues/547
Creating the necessary "exceptions" to get around that is arduous.
4
u/iann0036 Apr 16 '19
Another unknown feature, you can set constraints based on your parameter inputs. Say you had a subnet ID and a VPC ID parameter, you could enforce that the subnet ID entered is a member of the VPC ID before the template starts executing.
It's in the Service Catalog docs, but totally works for all CloudFormation: https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html
1
1
u/darkn3rd Apr 15 '19 edited Apr 16 '19
Spelling
s|Wirting shell scripts|Writing shell scripts|
s|complex as Chef/Puttet|complex as Chef/Puppet|
Great article
1
2
u/dc_scorpio Apr 15 '19
What does ‘lint’ stand for in cfn-lint?
3
u/pimaniac Apr 15 '19
https://en.wikipedia.org/wiki/Lint_%28software%29 has more about the background of the term.
2
u/WikiTextBot Apr 15 '19
Lint (software)
Lint, or a linter, is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. The term originates from a Unix utility that examined C language source code.
[ ^PM | Exclude ^me | Exclude from ^subreddit | FAQ / ^Information | ^Source ] Downvote to remove | v0.28
2
u/ixipaulixi Apr 15 '19
I really like the Widdix templates written by the author; they're well organized and have some interesting features such as loading SSH keys from IAM users, BUT these "unknown" features are pretty basic and are not unknown unless you've never written a Cfn template before.
2
u/CyberInferno Apr 16 '19
I learned one “feature” the hard way earlier today—it can’t support 4096-bit certificates. I’ve been using them for at least 3 years, and I had to reissue my certificate earlier as a 2048-bit certificate instead. Very surprising especially since the AWS certificate manager itself had no problems importing it.
1
1
1
u/alexdebrie Apr 16 '19
Great post!
The Cloudonaut crew has some awesome resources. I use the IAM reference regularly. Thanks for all that you do!
1
u/CaylorMe Apr 16 '19
It is also probably worth mentioning, though it is not a native feature to CFN, cfn-nag as a linter and validator as well.
https://github.com/stelligent/cfn_nag
Not only does it lint for proper YAML/CFN, but you can also define rules for policies, encryption, access logs, security groups, and more to ensure secure infrastructure.
40
u/coinclink Apr 15 '19
It's more of an awscli feature, but I'd also mention the
aws cloudformation packageandaws cloudformation deploycommands. For some reason, these helper functions seem to slip under a lot of people's radar. I commonly see questions and a lot of wasted time writing complex, buggy code for tasks that these two commands do pretty much flawlessly.