What is Terraform -
Ok, so Terraform is Open-Source Infrastructure-as-Code(IAC) software tool which created by HashiCrop. The idea behind IAC is to define, deploy, update and destroy your infrastructure without any much difficulties. The main idea behind this is to treat everything as a code. No matter what it is.
In this article, I am going in deep to explain about the software and compare this with other lots of available tool sets which together can be replaced this e.g. ansible, chef, puppet, salt, CloudFormation, ARM etc.
In this specific article, I'll just show how easily we can launch a basic EC2 instance with a small code set. Terraform is simple binary which you can download and put that in your path.
Below is the main architecture diagram which we are going to simulate.
Create a file "main.tf" where tf stands for teffaform. Add below code snippet to this file.
Set up your AWS credentials. Here for just testing you can set below variable with you AWS access and secret keys. There are other better ways to handle your credentials, but here I am just using these variable for testing.
$ export AWS_ACCESS_KEY_ID=(your access key id) $ export AWS_SECRET_ACCESS_KEY=(your secret access key)
Next, step is to initialise the terraform, using $terraform init, reason for doing this is because when you specify the provider on the first line, terraform was not having specific plugins to do his job. So after this command it will actually generate a ".terraform" directory with all the required plugin for mentioned provider.
Output -
Next is to check if everything is correct before implementing the changes. You can use "$terraform plan" to check this as below:
Finally, Let apply these changes to launch the EC2 instance in AWS.
Check AWS console for the instance availability:
This is really an amazing post, Thanks for sharing.
ReplyDeleteDevOps Online Training institute
DevOps Online Training in Hyderabad
I found this informative and interesting blog DevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
ReplyDeleteDigital Lync offers one of the best Online Courses Hyderabad with a comprehensive course curriculum with Continuous Integration, Delivery, and Testing. Elevate your practical knowledge with quizzes, assignments, Competitions, and Hackathons to give a boost to your confidence with our hands-on Full Stack Training. An advantage of the online Cources development course in Hyderabad from Digital Lync is to get industry-ready with Career Guidance and Interview preparation.
ReplyDeleteDevOps Training Institute
Python Training Institute
AWS Training Institute
Online Full Stack Developer Course Hyderabad
Python Course Hyderabad
Online AWS Training Course Hyderabad
devops training in hyderabad
angular training in hyderabad