Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tutorial of how to connect to GCE Linux instances

NotificationsYou must be signed in to change notification settings

lrakai/gce-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Tutorial of how to connect to GCE Linux instances.

Final environment

Getting Started

  1. Ensure the Following APIs are enabled (enable with gcloud services enable [service]):

    • compute.googleapis.com
  2. Ensure the default Google APIs service account (used by deployment manager) has permission to create roles:

    • In macOS/Linux:

      project_id=$(gcloud config list --format'value(core.project)')project_number=$(gcloud projects list --filter"id:ca-labs" --format'value(projectNumber)')gcloud projects add-iam-policy-binding$project_id \  --member serviceAccount:$project_number@cloudservices.gserviceaccount.com \  --role roles/iam.roleAdmin
    • In Windows (PowerShell):

      $project_id= gcloud config list--format'value(core.project)'$project_number= gcloud projects list--filter"id:ca-labs"--format'value(projectNumber)'gcloud projectsadd-iam-policy-binding$project_id`--member serviceAccount:$project_number@cloudservices.gserviceaccount.com`--role roles/iam.roleAdmin
  3. Deploy the deployment manager config in theinfrastructure directory:

    gcloud deployment-manager deployments create lab --config infrastructure/deployment.yaml
  4. Bind the Lab role to the student user or group:

    • In macOS/Linux:

      member="[GROUP_OR_USER]"project_id=$(gcloud config list --format'value(core.project)')role=$(gcloud iam roles list --project$project_id \                             --filter"name:projects/$project_id/roles/studentrole*" \                             --format"value(name)")gcloud projects add-iam-policy-binding$project_id \--member$member  \--role$role
    • In Windows (PowerShell):

      $member="[GROUP_OR_USER]"$project_id= gcloud config list--format'value(core.project)'$role= gcloud iam roles list--project$project_id`--filter"name:projects/$project_id/roles/studentrole*"`--format"value(name)"gcloud projectsadd-iam-policy-binding$project_id`--member$member`--role$role

    An example of[GROUP_OR_USER] isuser:student@gmail.com.

Following Along

  1. ClickSSH from theVM instances GCE tab to connect to the instance using SSH from the Browser.

  2. Paste a public key into the instance or project SSH key metadata and connect using a standard SSH client.

Tearing Down

When finished, remove the GCP resources with:

  • In macOS/Linux:

    gcloud projects remove-iam-policy-binding$project_id \    --member$member  \    --role$rolegcloud deployment-manager deployments delete -q lab
  • In Windows (PowerShell):

    gcloud projectsremove-iam-policy-binding$project_id`--member$member`--role$rolegcloud deployment-manager deployments delete-q lab

About

Tutorial of how to connect to GCE Linux instances

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp