Skip to content

Instantly share code, notes, and snippets.

@erdnuesse
Last active February 21, 2019 09:43
Show Gist options
  • Save erdnuesse/ddc3d23b8e9fd5db2ab04d9187ad7c42 to your computer and use it in GitHub Desktop.
Save erdnuesse/ddc3d23b8e9fd5db2ab04d9187ad7c42 to your computer and use it in GitHub Desktop.
Small script for creating a GCP Project, enable billing and OS_Login on compute engine.
#######################################
# project creation script for GCP #
# created by: Kay Urbach #
# (c)2019 #
# run as ./createproject.sh [PROJECT] #
#######################################
#!/bin/bash
# parsing arguments
# edit here if needed
PROJECT="$1"
# 000000-000000-000000 is the Account for testing and development
BILLING="000000-000000-000000"
# organization 1234567890 is <Org name>
ORG="1234567890"
# static content
# keep this untouched for now
echo Installing deps...
gcloud components install alpha
echo Creating project...
gcloud projects create $PROJECT --organization=$ORG
echo Setting project as staging area...
gcloud config set project $PROJECT
# edit if billing is no longer alpha
echo Enable billing...
gcloud alpha billing projects link $PROJECT --billing-account $BILLING
echo Enable compute engine...
gcloud services enable --project $PROJECT compute.googleapis.com
echo Enable oslogin...
gcloud compute project-info add-metadata --metadata enable-oslogin=TRUE
echo "Your Cloud SDK properties for the currently active configuration...:"
gcloud config list
echo done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment