GCP Free Learning
,

How to create a new App Engine application in GCP?

by

GCP Free Learning

Creating a new App Engine application in GCP can be done using the Google Cloud Console, CLI commands, or Terraform. Here, we will explain each approach in detail:

  1. Google Cloud Console:
    a. Go to the GCP Console: https://console.cloud.google.com/
    b. Select your project or create a new one.
    c. Navigate to the App Engine dashboard by clicking the hamburger menu, then click on “App Engine.”
    d. Click “Create Application.”
    e. Select a region for your application and click “Next.”
    f. Choose a runtime environment (e.g., Python, Java, Node.js, Go, etc.) and click “Next.”
    g. Follow the instructions to create the app.yaml file and deploy your application.
  2. CLI Commands (gcloud):
    a. Install and set up the Google Cloud SDK: https://cloud.google.com/sdk/docs/install
    b. Authenticate with your GCP account: gcloud auth login
    c. Set the active project: gcloud config set project PROJECT_ID
    d. Create an app.yaml file with the necessary configurations (runtime, service, etc.).
    e. Deploy the App Engine application: gcloud app deploy app.yaml
  3. Terraform:
    a. Install Terraform: https://learn.hashicorp.com/tutorials/terraform/install-cli
    b. Create a main.tf file with the required provider and resource configurations:
provider "google" {
  project = "PROJECT_ID"
  region  = "REGION"
}

resource "google_app_engine_application" "app" {
  project     = "PROJECT_ID"
  location_id = "REGION"

  serving_status = "SERVING"

  feature_settings {
    split_health_checks = true
  }
}

resource "google_app_engine_standard_app_version" "app_version" {
  version_id = "v1"
  service    = "default"
  runtime    = "python39"

  entrypoint {
    shell = "gunicorn -b :$PORT main:app"
  }

  deployment {
    zip {
      source_url = "https://storage.googleapis.com/YOUR_BUCKET/YOUR_APP_SOURCE.zip"
    }
  }

  env_variables = {
    VAR_NAME = "VAR_VALUE"
  }

  automatic_scaling {
    cool_down_period_seconds      = 120
    max_instances                 = 5
    min_instances                 = 1
    target_cpu_utilization        = 0.75
    target_throughput_utilization = 0.75
  }
}

resource "google_storage_bucket" "bucket" {
  name = "YOUR_BUCKET"
}

c. Initialize the Terraform project: terraform init
d. Review the Terraform plan: terraform plan
e. Apply the Terraform plan: terraform apply

Replace the placeholders (e.g., PROJECT_ID, REGION, YOUR_BUCKET, and YOUR_APP_SOURCE) with the appropriate values for your project.

Glance and Google’s Next-Level Gaming Recommendation Engine

Collaborative Excellence: Glance and Google’s Next-Level Gaming Recommendation Engine Introduction: In the dynamic gaming industry, personalized recommendations are crucial for..

gcp_ml gcp_ml

Digits and Google Cloud ML

How Digits is Transforming the Accounting Landscape Using Google Cloud ML The finance and accounting industry is experiencing a significant..

GCP AI GCP AI

Google Cloud’s Vertex AI Model Garden and the Launch of Generative AI Studio

Google Cloud’s Vertex AI Model Garden and the Launch of Generative AI Studio Artificial Intelligence (AI) and Machine Learning (ML)..

GCP AI/ML GCP AI/ML

Google Cloud’s Pioneering AI Models and the Launch of Generative AI Studio

 Google Cloud’s Pioneering AI Models and the Launch of Generative AI Studio Artificial Intelligence (AI) continues to break new grounds,..

GCP App Engine GCP App Engine

How to scale an App Engine application in GCP?

Scaling an App Engine application involves configuring the scaling settings in the app.yaml file and deploying the changes. I’ll provide..

Leave a Reply

Your email address will not be published. Required fields are marked *