Sunday, October 21, 2018

Create SonarQube instance using Terraform - Setup SonarQube instance using Terraform

Execute the below command after login to EC2 where you installed Terraform:

navigate to project-terraform folder where you have created already tf files.

cd ~/project-terraform

if you are using Apple laptop or EC2 instance, execute below command:

sudo vi 

for Windows laptop use below command:


Copy the below content with green background:

Change the key name marked red below per your key name:

    resource "aws_instance" "myFirstInstance_sonar" {
      ami           = "

      key_name = "ChangeMeKey"
      instance_type = "t2.micro"
      security_groups= [ "
      tags= {
        Name = "sonar_instance"

 resource "aws_security_group" "security_sonar_group_2019" {
      name        = "security_sonar_group_2019"
      description = "security group for Sonar"

      ingress {
        from_port   = 9000
        to_port     = 9000
        protocol    = "tcp"
        cidr_blocks = [""]

     ingress {
        from_port   = 22
        to_port     = 22
        protocol    = "tcp"
        cidr_blocks = [""]

     # outbound from Sonar server
      egress {
        from_port   = 0
        to_port     = 65535
        protocol    = "tcp"
        cidr_blocks = [""]

      tags= {
        Name = "security_sonar"

3.  execute below command:
    terraform plan
4. and then
    terraform apply

Now you will see a new instance being created in AWS console.


  1. Replies
    1. Great Article Cloud Computing Projects

      Networking Projects

      Final Year Projects for CSE

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. According to SEO experts, they help business owners deliver their sites to top rank search engines. click to read This is because a recent research on SEO returns for a period of 12 months shows that at least all the players had something to take home.