The CloudSOE SonarQube image gives you a complete SonarQube stack (SonarQube Community Build with a local PostgreSQL database) on a hardened Ubuntu base, with the kernel and ulimit tuning SonarQube’s embedded Elasticsearch requires already applied. The image contains no baked-in passwords: on first boot your instance generates two separate unique passwords (one for the SonarQube admin account, one for the database) and writes them to a protected credentials file.

What you’ll need

  • An AWS account subscribed to the CloudSOE SonarQube listing on AWS Marketplace
  • An EC2 key pair in your target region (SSH is key-based only)
  • About ten minutes

Step 1: Launch the instance

  1. Open the SonarQube listing on AWS Marketplace and click Continue to Subscribe, then Continue to Configuration.
  2. Pick your region and click Continue to Launch → Launch through EC2.
  3. Choose an instance type. t3.medium (2 vCPU, 4 GB RAM) is the practical minimum: SonarQube runs a web server, compute engine, Elasticsearch and PostgreSQL on one box.
  4. Select your key pair, and give the root volume at least 30 GB.

Prefer the CLI? Once subscribed:

aws ec2 run-instances \
  --image-id <ami-id-from-the-listing> \
  --instance-type t3.medium \
  --key-name my-key \
  --security-group-ids sg-xxxxxxxx \
  --subnet-id subnet-xxxxxxxx \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=sonarqube-01}]'

Step 2: Open the firewall ports

Your security group needs exactly two inbound rules:

PortProtocolPurpose
22TCPSSH administration
9000TCPSonarQube web interface

Restrict both to your own IP range (or your CI runners’ range) where possible.

Step 3: Let first boot finish

First boot runs in two one-time services. Before SonarQube starts, sonarqube-firstboot:

  • generates two distinct passwords meeting SonarQube’s password policy (one for the database, one for the admin account),
  • sets the database password on the PostgreSQL sonar role and in SonarQube’s database configuration,
  • saves both to the credentials file.

Then, once SonarQube is up, sonarqube-admin-password replaces the default admin/admin login with the generated admin password (it retries until that succeeds).

SonarQube itself takes a couple of minutes to start (Elasticsearch indexing). You can watch:

ssh ubuntu@<public-ip>
systemctl status sonarqube-firstboot sonarqube-admin-password sonar

Step 4: Retrieve your credentials

SSH in as the ubuntu user. The login banner (MOTD) shows your instance’s URL and points at the credentials file:

cat /opt/default-sonar-login.txt

This file (mode 600) holds the generated passwords for the SonarQube admin account and the PostgreSQL sonar user. They are different passwords.

Step 5: Log in and run your first analysis

Browse to http://<public-ip>:9000 and sign in as admin with the generated password. Create a project (Projects → Create Project → Local project), generate a token, and point a scanner at your server from your build machine:

sonar-scanner \
  -Dsonar.host.url=http://<public-ip>:9000 \
  -Dsonar.token=<your-token>

Next steps