Spring Boot on GCP
  • Introduction
  • Getting Started
    • Google Cloud Platform
    • Cloud Shell
    • gcloud CLI
    • Hello World!
      • Cloud Shell
      • App Engine
      • Cloud Run
      • Kubernetes Engine
      • Compute Engine
      • Cloud Functions
  • Application Development
    • Development Tools
    • Spring Cloud GCP
    • Cloud Services
      • Databases
        • Cloud SQL
        • Cloud Spanner
        • Cloud Firestore
          • Datastore Mode
          • Native Mode
      • Messaging
        • Cloud Pub/Sub
        • Kafka
      • Secret Management
      • Storage
      • Cache
        • Memorystore Redis
        • Memorystore Memcached (beta)
      • Other Services
    • Observability
      • Trace
      • Logging
      • Metrics
      • Profiling
      • Debugging
    • DevOps
      • Artifact Repository
  • Deployment
    • Runtime Environments
    • Container
      • Container Image
      • Secure Container Image
      • Container Awareness
      • Vulnerability Scanning
      • Attestation
    • Kubernetes
      • Kubernetes Cluster
      • Deployment
      • Resources
      • Service
      • Health Checks
      • Load Balancing
        • External Load Balancing
        • Internal Load Balancing
      • Scheduling
      • Workload Identity
      • Binary Authorization
    • Istio
      • Getting Started
      • Sidecar Proxy
  • Additional Resources
    • Code Labs
    • Presentations / Videos
    • Cheat Sheets
Powered by GitBook
On this page
  • Getting Started
  • Clone
  • Build
  • Deploy
  • Connect
  • Additional Configuration
  • Learn More

Was this helpful?

  1. Getting Started
  2. Hello World!

App Engine

Deploy a JAR to a fully managed PaaS with just one command.

PreviousCloud ShellNextCloud Run

Last updated 4 years ago

Was this helpful?

is a fully managed Platform-as-a-Service that can run your application, provision a HTTPS load balancer, and scale out your workload as needed. When no one is using your application, it can scale down to zero.

Getting Started

Clone

cd $HOME
git clone https://github.com/saturnism/jvm-helloworld-by-example
cd jvm-helloworld-by-example/helloworld-springboot-tomcat

Build

./mvnw package

Deploy

gcloud app deploy target/helloworld.jar

If this is your first time using App Engine on the project, you'll be prompted to choose a region. Pick the region that's most suitable for your application. This site mostly uses us-central as an example.

Once you select the region, you cannot change it for an App Engine application.

Connect

Once deployed, the command will output the HTTPs URL. To open the URL in your browser:

gcloud app browse

To find the URL without opening the browser:

gcloud app browse --no-launch-browser

You can curl the URL:

URL=$(gcloud app browse --no-launch-browser)
curl ${URL}

You can run any Java service in App Engine as long as it's packaged as a JAR file, and can be executed with java -jar app.jar.

Additional Configuration

By default, App Engine will deploy with the smallest F1instance class. You can specify a larger instance, configure environment variables, and more tuning parameters using an app.yaml:

app.yaml
runtime: java11
instance_class: F4
env_variables:
  SPRING_PROFILES_ACTIVE: "prod"

Deploy the JAR file with the configuration:

gcloud app deploy target/helloworld.jar \
  --appyaml app.yaml

Learn More

See for a list of Instance Classes and associated CPU/Memory resources.

Learn more about the configurations in .

App Engine Standard Instance Classes documentation
app.yaml reference documentation
App Engine Java 11 documentation
Deploy with App Engine Maven plugin
Deploy with App Engine Gradle plugin
App Engine