Deep Dive on Nested Template Concept with CodeCommit Repo
Tags: awscodecommit, cloudformationtemplate, nestedstack, buildspec
Published: 2024-02-11 16:48:06

“ I have deep dive into the concept of nested template creation in codecommit repo for a parent template file. I have faced the limitation issue of envmap parameter to define in template.yaml file. So I got a solution to create a nested template. Pricing of codecommit repo depends on commit users.”

AWS CodeCommit is a version control service hosted by AWS that you can use to privately store and manage assets in the cloud. For information about pricing for codecommit, see [Pricing](http://aws.amazon.com/codecommit/pricing/).

Nested stacks are stacks created as part of other stacks. We can create it using the AWS::CloudFormation::Stack resource.

In this post, you will get to know how to create a nested template (child template) for the main template (parent template). Here I have created codecommit repo and template files.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piv5noqwy60w5xocfkev.png)
The architecture diagram shows the overall deployment architecture with data flow, aws codecommit repo and template files.

#Solution overview
The blog post consist of the following phases:
1. Create of CodeCommit Repo with Buildspec.yml and Template.yaml File
2. Create of Nested1-template.yaml File in CodeCommit Repo

##Phase 1: Create of CodeCommit Repo with Buildspec.yml and Template.yaml File
1. Open the CodeCommit console and create a repository named “Gluedt-repo”. Create a buildspec.yml file containing commands to store cloudformation templates in s3 bucket during pipeline run to deploy the template service. In template.yaml file, define of nested stack configuration parameters to connect it with nested1-template.yaml template file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/536kp2mcbfnd6gsz4red.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drx89txmy4gv3pbxjki9.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ax9m3lqsjf97t6873yp7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n61bsxuopdyl11wgffef.png)

##Phase 2: Create of Nested1-template.yaml File in CodeCommit Repo

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/755vopd0i1jv0c1fqupb.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w0y7leu3ht3k93wgogyr.png)

#Clean-up
Delete CodeCommit Repo.

#Pricing
I review the pricing and estimated cost of this example. 

Cost of CodeCommit = $0.00 for first 5 CodeCommit users = $0.0

Total Cost = $0.0

#Summary
In this post, I showed “deep dive on nested template concept with codecommit repo”.

For more details on AWS CodeCommit, Checkout Get started AWS CodeCommit, open the [AWS CodeCommit console](https://us-east-1.console.aws.amazon.com/codesuite/codecommit/repositories?region=us-east-1#). To learn more, read the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit/?icmpid=docs_homepage_devtools).

##Working with nested stack - 

[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html)

##Reference link for creation of glue using cloudformation -

[https://dev.to/aws-builders/explore-customized-glue-parameters-database-table-and-partition-through-cloudformation-2fm7](https://dev.to/aws-builders/explore-customized-glue-parameters-database-table-and-partition-through-cloudformation-2fm7)

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)