<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rachana Achyuthuni on Medium]]></title>
        <description><![CDATA[Stories by Rachana Achyuthuni on Medium]]></description>
        <link>https://medium.com/@1995rachana?source=rss-a281226383ff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NlMebXRmsCVT5H8sqQh5bQ.jpeg</url>
            <title>Stories by Rachana Achyuthuni on Medium</title>
            <link>https://medium.com/@1995rachana?source=rss-a281226383ff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:08:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@1995rachana/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AWS CloudFormation Macros]]></title>
            <link>https://medium.com/@1995rachana/aws-cloudformation-macros-728fdbb0478a?source=rss-a281226383ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/728fdbb0478a</guid>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[cloudformation]]></category>
            <category><![CDATA[macro]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rachana Achyuthuni]]></dc:creator>
            <pubDate>Sun, 31 May 2020 23:14:20 GMT</pubDate>
            <atom:updated>2020-05-31T23:14:20.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AWS Logo" src="https://cdn-images-1.medium.com/max/620/1*0xat6E9sz6HStPqUYbfc8w.png" /></figure><p>Creating a Macro in CloudFormation to use S3 Bucket Name and Key Value (instead of the whole S3 URL) to specify Child Stack.</p><p><strong>About CloudFormation Macros</strong></p><ul><li>Macro is the magical solution to many frequently faced issues in AWS CloudFormation.</li><li>Macros can be used perform functions which are not directly supported by CloudFormation : from minor modifications to introducing new properties to tranforming entire templates. Just about anything!</li><li>Here’s the complete AWS provided guide with further information → <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-macros.html">AWS CloudFormation Macros</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x62byCjL8rkiP0h2VjpJSg.png" /><figcaption>AWS Guide for CloudFormation Macros</figcaption></figure><p><strong>Which custom feature are we creating?</strong></p><ul><li>Nested stacks is a very useful feature of CloudFormation. Using one stack, a child stack can be created by specifying the full Template URL of the S3 bucket in which the child template is found.</li><li>Using our custom feature, by merely specifying the Bucket Name and File Name, the URL would be automatically generated by the Macro.</li></ul><p><strong>Let’s get started!</strong></p><ol><li><strong>The first step is to create an AWS S3 Bucket in your account in which the child stack’s template is stored. Here are the steps:</strong></li></ol><p>a. In my child template, I have used YAML format to create an S3 Bucket as it is a very simple resource with hardly anything to specify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*alGCzwFRuzSS2ve2L3-xpg.png" /><figcaption>File name — child_stack.yaml</figcaption></figure><p>If you are unfamiliar on how to create an S3 Bucket, refer to this <a href="https://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html">link</a>.</p><p><strong>2. Create Macro which generates the template URL</strong></p><p>We would now how to create a Macro which would generate the Template URL automatically. In order to do this, I have created a CloudFormation template as follows:</p><p>a. The first resource in my template is an IAM Role resource which creates the role for our Lambda Function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TGh17mWspkOmlAgrBWtkFw.png" /></figure><p>b. Then, we need to create a Lambda Function which would modify the custom properties and add a new property — ‘TemplateURL’ using the Bucket name and the key specified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*TabwcGFsz36Cn1fBnGOUJg.png" /></figure><p>c. Then, we need to allocate permissions for CloudFormation to invoke this lambda function. This can be done using another CloudFormation resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*3SzdOvjdgWh00t3FGpCrUw.png" /></figure><p>d. Finally, we need to create the actual Macro Function resource with a specific name which can be called in our other templates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*C6T9OAmpP16r8AUrSZc4fQ.png" /></figure><p>Using this template, we would have to create a CloudFormation stack which would create the Macro. For steps on creating a Cloudformation stack, refer to this <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-create-stack.html">link</a>.</p><p>3. Testing the Macro.</p><p>To test this Macro, we would be launching another stack with the ‘Bucket’ and ‘Key’ properties which should automatically create a child stack.</p><p>The test stack’s template would be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*e2kYKZK49_id5rRWS4C9og.png" /><figcaption>test_macro.yaml</figcaption></figure><p>Key features of this template:</p><ul><li>In this test stack, using transforms we have mentioned the name of the Macro which will do the job of transforming the template as understandable by CloudFormation.</li><li>The Bucket property specifies my bucket name.</li><li>The key property specifies the file name of the child stack that I uploaded.</li></ul><p>For steps on creating a Cloudformation stack, refer to this <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-create-stack.html">link</a>.</p><p>For complete Macro templates, check out github repo — <a href="https://github.com/rachanamurthy/CloudFormation-Macros">https://github.com/rachanamurthy/CloudFormation-Macros</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=728fdbb0478a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>