-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
CloudCloud relatedCloud relatedGCPGoogle Cloud PlatformGoogle Cloud PlatformlinuxLinux relatedLinux relatedmacmacOS relatedmacOS related
Description
- Generate SSH key pair locally
ssh-keygen -t rsa -f <path/keyname> -C <username> - Enable OS Login functionality
- Go to the
metadatapage for the instance - Click Edit and add a metadata entry where the key is
enable-osloginand value isTRUE - Click Save to apply the changes
- Go to the
- Grant the following necessary IAM roles to the user account
roles/iam.serviceAccountUserroles/compute.osLoginorroles/compute.osAdminLogin
- Add the SSH public key to the Compute Engine instance
- Go to GCP console and click on Compute Engine > VM instances
- Click on the VM instance and click on Edit on top of the VM instance details page
- Scroll down to find the section SSH Keys
- Click Add item
- Paste the contents of the public key generated and click Save
-> DONE
SSH into the GCP Compute Engine instance with the following command:
ssh -i <path_to_private_key> <gcp_user_name>@<external_ip_address>
Metadata
Metadata
Assignees
Labels
CloudCloud relatedCloud relatedGCPGoogle Cloud PlatformGoogle Cloud PlatformlinuxLinux relatedLinux relatedmacmacOS relatedmacOS related