[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need Help With Emacs Tramp Mode For 'gcloud compute ssh'
From: |
Samuel Banya |
Subject: |
Need Help With Emacs Tramp Mode For 'gcloud compute ssh' |
Date: |
Sun, 08 Aug 2021 23:03:06 -0400 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-552-g2afffd2709-fm-20210805.001-g2afffd27 |
Hello there,
I have looked high and low on the internet, and can't find a decent answer on
how to utilize Tramp Mode for 'gcloud compute ssh'.
This is the command I need to run for work, since I remote into gcloud (GCP)
based jump boxes, so I need to use the '--project' parameter accordingly:
gcloud compute ssh --project ops-dist-(client's environment name) (client's
environment name)-cli
I have the following present in my Emacs config so far, but am completely stuck
as all there's to go off is the source code itself, and I really only use Org
Mode and Emacs for notes, and super light programming:
** WORK-SPECIFIC Add 'tramp' to easily ssh into gcp jumpbox and ssh into
'aa-master'
#+BEGIN_SRC emacs-lisp
(use-package tramp
:ensure t
:config
(add-to-list 'tramp-methods
'("gcssh"
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h --project example-project example-project-cli")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/bash")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
(tramp-default-port 22))))
(defun gcp-box-connect ()
(interactive)
(find-file "/gcssh:compute-instance:/path/to/filename.clj"))
;; NOTE: Uncommenting when I figure out the full path to what I need to add
and will most likely add it to a 'secrets' file:
;; Suggested format:
;; C-x C-f /gcssh:compute-instance:/path/to/filename.clj
(global-set-key (kbd "C-M-g") 'gcp-box-connect)
#+END_SRC
- Need Help With Emacs Tramp Mode For 'gcloud compute ssh',
Samuel Banya <=