Automated Ec2 Instance Deployment on AWS with Terragrunt and CircleCI
Introduction :-
Pre-requestisites:-
Circleci application with github (project) configured.
#Github Repository with Circleci full access.
Aws account with required Permissions
First you need to Login to your AWS account and Create a Iam user with Security credentials (Access and secret access keys).
Navigate to your s3 service and create an s3 bucket.
Next Login to your Circleci application and create a context with name #Terraform and Add the Downloaded Access&Secret keys as a environment variable to the terraform context like below.
4. Now Open your source code using a visual editor (visual-studio code) and open the “terragrunt.hcl” file which is located in the infra directory.
5. Replace values of aws account_id, s3 bucket and aws Profile name with your values.
6. Commit your changes and push the code to the #Github repository. Circleci will automatically trigger the changes and runs the pipeline.
7. Go to the circleci projects and check whether the pipeline got triggered or not.
8. As u can see that the Resource getting deployed by the circleci.
9. Login to the AWS and check whether the #EC2 instance got created or not.(as shown like below)
Source-code :- “https://github.com/MahiraTechnology/Mahira-medium.git”
Conclusion :-
By combining the strengths of Terragrunt and CircleCI, you’ve unlocked a world of possibilities for your infrastructure automation. You’ve learned how to structure your infrastructure code for better organization and reuse, how to utilize Terragrunt to manage multiple environments effortlessly, and how CircleCI can orchestrate and automate the entire deployment process. #InfrastructureAutomation #Terragrunt #CircleCI #AWS #DevOps #ContinuousIntegration #ContinuousDeployment