{"id":1104,"date":"2018-02-19T02:06:06","date_gmt":"2018-02-19T02:06:06","guid":{"rendered":"http:\/\/wiki.thomasandsofia.com\/?p=1104"},"modified":"2018-02-19T02:51:39","modified_gmt":"2018-02-19T02:51:39","slug":"cloudformation-resources","status":"publish","type":"post","link":"https:\/\/wiki.thomasandsofia.com\/?p=1104","title":{"rendered":"CloudFormation Resources"},"content":{"rendered":"<p><a href=\"https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0<\/a><\/p>\n<p><a href=\"http:\/\/wiki.thomasandsofia.com\/2018\/02\/18\/cloud-formation-main-menu\/\">Course Main Menu<\/a><\/p>\n<h2>Section 4 Main Menu<\/h2>\n<ul>\n<li><a href=\"#overview\">Overview<\/a><\/li>\n<li><a href=\"#hands\">Hands On<\/a><\/li>\n<li><a href=\"#optional\">Optional Attributes<\/a><\/li>\n<li><a href=\"#faq\">Resources FAQ<\/a><\/li>\n<li><a href=\"#quiz\">Quiz<\/a><\/li>\n<\/ul>\n<p><a name=\"overview\"><\/a><\/p>\n<h2>Overview<\/h2>\n<p><a href=\"https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0<\/a><\/p>\n<h3>What are resources<\/h3>\n<ul>\n<li>Resources are the core of your CF template<\/li>\n<li>They represent the different AWS components that will be created and configured.<\/li>\n<li>Resources are declared and can reference each other<\/li>\n<li>AWS figures out create, updates and deletes of resources for us.<\/li>\n<li>There are over 224 types of resources<\/li>\n<li>Resource type identifiers are of the form:\n<ul>\n<li>AWS::aws-product-name::data-type-name<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>How do I find resources documentation<\/h3>\n<ul>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-template-resource-type-ref.html\" target=\"_blank\" rel=\"noopener\">AWS Resource Types Reference<\/a>\n<ul>\n<li>Example: <a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-instance.html#aws-properties-ec2-instance-prop\" target=\"_blank\" rel=\"noopener\">EC2 Instance<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Remember, you can also locate these documents through the CF Designer!<\/li>\n<\/ul>\n<p><a name=\"hands\"><\/a><\/p>\n<h2>Hands On<\/h2>\n<p><a href=\"https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8161728?start=0\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8161728?start=0<\/a><\/p>\n<h3>EC2 Instance + Security Group + Elastic IP<\/h3>\n<pre>---\r\nResources:\r\n  MyInstance:\r\n    # http:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-instance.html\r\n    Type: AWS::EC2::Instance\r\n    Properties:\r\n      AvailabilityZone: us-east-1a\r\n      ImageId: ami-a4c7edb2\r\n      InstanceType: t2.micro\r\n      SecurityGroups:\r\n        - !Ref SSHSecurityGroup\r\n        - !Ref ServerSecurityGroup\r\n\r\n  MyEIP:\r\n    # http:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-eip.html\r\n    Type: AWS::EC2::EIP\r\n    Properties:\r\n      InstanceId: !Ref MyInstance\r\n\r\n  SSHSecurityGroup:\r\n    # http:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-security-group.html\r\n    Type: AWS::EC2::SecurityGroup\r\n    Properties:\r\n      GroupDescription: Enable SSH access via port 22\r\n      SecurityGroupIngress:\r\n      - CidrIp: 0.0.0.0\/0\r\n        FromPort: 22\r\n        IpProtocol: tcp\r\n        ToPort: 22\r\n\r\n  ServerSecurityGroup:\r\n    # http:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-security-group.html\r\n    Type: AWS::EC2::SecurityGroup\r\n    Properties:\r\n      GroupDescription: allow connections from specified CIDR ranges\r\n      SecurityGroupIngress:\r\n      - IpProtocol: tcp\r\n        FromPort: 80\r\n        ToPort: 80\r\n        CidrIp: 0.0.0.0\/0\r\n      - IpProtocol: tcp\r\n        FromPort: 22\r\n        ToPort: 22\r\n        CidrIp: 192.168.1.1\/32\r\n<\/pre>\n<ul>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-instance.html\" target=\"_blank\" rel=\"noopener\">EC2 Instance<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-security-group.html\" target=\"_blank\" rel=\"noopener\">Security Group<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-properties-ec2-eip.html\" target=\"_blank\" rel=\"noopener\">Elastic IP<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><a name=\"optional\"><\/a><\/p>\n<h2>Optional Atttributes (Advanced)<\/h2>\n<ul>\n<li>DependsOn:\n<ul>\n<li>Create a dependency between two resources.\n<ul>\n<li>Only create and ECS (Elastic Container Service) cluster after creating an ASG (Auto scaling group)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>DeletionPolicy:\n<ul>\n<li>Protect resources from being deleted even if the cloudformation is deleted.\n<ul>\n<li>Example: RDS Database<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>CreationPolicy:\n<ul>\n<li>More details in the CFN init<\/li>\n<\/ul>\n<\/li>\n<li>Metadata:\n<ul>\n<li>Anything you want, get creative!<\/li>\n<li>Additional examples in the CFN init section.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a name=\"faq\"><\/a><\/p>\n<h2>Frequently Asked Questions<\/h2>\n<p><a href=\"https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139084?start=0\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139084?start=0<\/a><\/p>\n<ul>\n<li>Can I create a dynamic amount of resources?\n<ul>\n<li>No. Everything in the CF template has to be declared.\u00a0 You cannot perform code generation there.<\/li>\n<li>There is a work around using the troposphere library<\/li>\n<\/ul>\n<\/li>\n<li>Is every AWS service supported?\n<ul>\n<li>Almost.\u00a0 Only a select few niches are not ready yet.<\/li>\n<li>This can be worked around using Lambda Custom Resources.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a name=\"quiz\"><\/a><\/p>\n<h2>Quiz<\/h2>\n<h4>How many type of resources are available in CloudFormation<\/h4>\n<ul>\n<li>Less than 20<\/li>\n<li>Between 20 and 100<\/li>\n<li>Between 100 and 200<\/li>\n<li><strong>Over 200<\/strong><\/li>\n<\/ul>\n<h4>How do I learn about a specific Resource type?<\/h4>\n<ul>\n<li>&#8230;ask Thomas, he knows everything!<\/li>\n<li><strong>Use the documentation<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0 Course Main Menu Section 4 Main Menu Overview Hands On Optional Attributes Resources FAQ Quiz Overview https:\/\/www.udemy.com\/aws-cloudformation-master-class\/learn\/v4\/t\/lecture\/8139078?start=0 What are resources Resources are the core of your CF template They represent the different AWS components that will be created and configured. Resources are declared and can reference each other AWS figures out create, updates and ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/?p=1104\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-1104","post","type-post","status-publish","format-standard","hentry","category-cloudformation"],"_links":{"self":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1104"}],"version-history":[{"count":5,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1104\/revisions"}],"predecessor-version":[{"id":1111,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1104\/revisions\/1111"}],"wp:attachment":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}