Automate your AWS architecture diagrams
If you use terraform or any other IaC solution to provision your cloud infrastructure, you might have faced some of these questions.
?? How do I automate the infrastructure design diagram and infrastructure cost estimates?
?? How can I keep my infrastructure design diagram up to date with my IaC?
?? How can I get an architecture diagram that accurately represents my Infrastructure As Code?
?? How can I see a visual representation of all the changes my PR will make to the infrastructure?
?? How does my PR impact the infra cost?
?? Can I see the historical changes to my infrastructure not just as code but also as an architecture diagram?
?? How do I generate my cloud architecture diagram as part of CI-CD?
Recently I tried my hands with a couple of tools to solve these common IaC scenarios.
Pluralith is a tool to visualize your Terraform state and automate infrastructure documentation. It also helps detect and visualize infrastructure?drift and the?cost?of your infrastructure (via Infracost).
This approach of arriving at the architecture from the terraform state, I feel, is better than some of the diagram as code solutions since you do not need to maintain anything additional apart from your terraform code. There are a few other similar solutions out there like inframap, brainboard, etc. However, the CI-CD integration of Pluralith can be a differentiator.
Infracost shows cloud cost estimates for Terraform. It lets DevOps, SRE, and engineers see a cost breakdown and understand costs?before making changes in the terminal or pull requests.
As a demo solution, I tried to incorporate both these tools into an IaC pipeline using Github Actions and tried to update PR comments with proposed architectural and cost changes.
All the code for this demo and the implementation details are available on Github.
The Infracost run of the pipeline adds information in the PR comments that provide a view of the change in cost estimates that the PR will make.
领英推荐
The Pluralith run of the pipeline adds information in the PR comments that provide a view of the infrastructure changes that the PR will make and provides a view of the infrastructure's created, updated, destroyed, recreated, and drifted components.
You could add the Pluralith Infrastructure diagram in your RAEDME.md by just adding one line in your readme file.
Pluralith Dashboard
The Pluralith dashboard provides a consolidated view of the Infrastructure with the option of drilling down to individual infrastructure components. It provides a view of the infrastructure's created, updated, destroyed, recreated, and drifted components. Pluralith can be run locally as well.
Cost View
The Cost view of the dashboard provides a view of which component will make what cost estimate changes. The cost component uses Infracost to get the cost estimates.
History
The Dashboard also provides an option to view historical changes that the Infrastructure has gone through with the option of drilling down to the cost and design of all the components for these runs.
Terraform Cloud does provide features for a cost estimate for a limited number of services and the capability to set policies around cost; however, you need to purchase the enterprise edition for this feature.
Terraform also has a feature to generate an architecture diagram using terraform graph; however, it is pretty rudimentary at this point.
It will be interesting to see how these tools and features evolve in this space of IaC.
While Pluralith is free for local use, the CI runs come at a cost. They made the cost changes in the past week itself. I did my tests last weekend and got some CI runs before the changes were made. :)
Senior Growth Manager & CSM
2 年Great post and questions Pinaki! Thanks for the mention ?? Happy to guide you through Brainboard