← All tutorials

Deploy ASP.NET Core to Google Cloud

Free forever: 1 e2-micro VM (1 GB), plus $300 in credit for 90 days.

Google Cloud gives every account one small e2-micro instance for free, forever, in a handful of US regions — on top of a $300 / 90-day trial credit you can use for a larger box while you’re testing. DotDeployer connects to Google Cloud with a service account key, the same way any other tool authenticates to GCP’s Compute Engine API.

1. What you need

  • A Google account.
  • A Google Cloud project with the Compute Engine API enabled.
  • A service account JSON key with permission to manage Compute Engine instances.
  • A DotDeployer account.

2. Create the account and the API credential

  1. Go to console.cloud.google.com/freetrial and sign in. Choose account type Business, add a card (only a small temporary hold, not a charge) and start the free trial — you get $300 of credit for 90 days, and quota-increase requests are blocked in trial mode, which is fine for a single small VM.
  2. Create a new project from the project picker at the top of the console.
  3. Open APIs & Services → Library, search for Compute Engine API, and enable it for the project.
  4. Open IAM & Admin → Service Accounts → Create service account, give it a name, and grant it the Compute Admin role.
  5. Click the new service account, open the Keys tab, choose Add key → Create new key → JSON, and download it. This file is what you paste into DotDeployer in the next step — delete it from your downloads afterward.

The Google Cloud console's Create service account key screen

3. Connect it in DotDeployer

  1. In DotDeployer, go to Settings → Providers → Connect a provider → Google Cloud.
  2. Give the credential a name, paste in the full contents of the service account JSON file, and set the zone — the always-free e2-micro is only available in us-west1, us-central1 and us-east1.
  3. Click Test connection, then Connect. DotDeployer encrypts the key at rest and only ever calls the Compute Engine endpoints it needs.

The DotDeployer Settings → Providers screen with Google Cloud connected

4. Create the server

  1. From Servers → Create server, pick Google Cloud, choose the zone that matches your credential, and select an e2-micro (free) or a larger e2-small if you’re using the trial credit for something heavier.
  2. DotDeployer provisions the instance and bootstraps it — firewall rules, unattended security updates, the ASP.NET Core runtime, nginx — and the server shows Active once it’s ready.

The DotDeployer Servers list

5. Add a site and deploy from GitHub

  1. From the server, click Add site and connect the GitHub repository you want to deploy.
  2. DotDeployer publishes your app on the instance, sets it up behind nginx as a systemd service, and streams the deployment log as it runs.
  3. Future pushes to that branch deploy automatically; DotDeployer keeps the last five releases so you can roll back instantly.

A site's deployment history in DotDeployer

6. Database and environment variables

Install PostgreSQL or SQL Server on the same instance from the site’s Database tab — the database port is never opened to the internet, you reach it from your laptop through an SSH tunnel. Add your connection string and any other configuration under Environment variables; it’s encrypted at rest and delivered to the server as a systemd EnvironmentFile.

A site's Environment variables screen

7. HTTPS

Point an A record at the instance’s external IP, then add the domain under the site’s Settings tab (Domains section). DotDeployer requests a Let’s Encrypt certificate and renews it automatically — a 1 GB e2-micro handles this fine, since certificate issuance runs once and renewal is a quick background job.

That IP is reserved with GCP, not just assigned to the instance — point your A record once and it survives a reprovision, so you never have to edit DNS again after a rebuild.

A site's Settings screen with the domain and HTTPS certificate

8. What to check

  • The site is reachable over HTTPS with a valid certificate.
  • The deployment log shows the latest commit as the live release.
  • Google Cloud’s own Billing page shows the instance still within the free tier or your trial credit, especially if you sized up to e2-small for testing.
  • If you’re still in the 90-day trial when it ends, GCP stops your resources unless you upgrade to a paid account — decide before day 90 whether you want to keep the box running past the free e2-micro.