Move aws-mfa to AWS config and add CDE aws profile

This commit is contained in:
Jeremy Dormitzer 2020-12-16 12:04:28 -05:00
parent 80abf2fd43
commit da1ea87088

View File

@ -5375,12 +5375,38 @@ Switch AWS profiles:
(setq aws-current-profile (getenv "AWS_PROFILE"))
(add-to-list 'aws-profiles "personal")
(add-to-list 'aws-profiles "cde")
(defun aws-switch-profile (profile)
(interactive (list (completing-read "Profile: " aws-profiles)))
(setenv "AWS_PROFILE" profile)
(setq aws-current-profile profile))
#+END_SRC
** AWS-MFA
The aws-mfa command:
#+BEGIN_SRC emacs-lisp
(defun aws-mfa (mfa-token)
(interactive (list
(let ((prompt (if aws-current-profile
(format "MFA code for %s: " aws-current-profile)
"MFA code: ")))
(read-from-minibuffer prompt))))
(let ((proc (start-process "aws-mfa"
"*aws-mfa*"
"aws-mfa"
"--force")))
(set-process-sentinel
proc
(make-success-err-msg-sentinel "*aws-mfa*"
"AWS MFA succeeded"
"AWS MFA failed, check *aws-mfa* buffer for details"))
(process-send-string proc (concat mfa-token "\n"))))
(with-eval-after-load 'kubernetes
(general-def kubernetes-overview-mode-map "m" #'aws-mfa))
#+END_SRC
** S3
#+BEGIN_SRC emacs-lisp
(use-package s3ed
@ -5860,26 +5886,6 @@ Run pip install in the current project:
(compile (format "pip install -r %s" reqs))))
#+END_SRC
** AWS-MFA
The aws-mfa command:
#+BEGIN_SRC emacs-lisp
(defun aws-mfa (mfa-token)
(interactive "MMFA code: ")
(let ((proc (start-process "aws-mfa"
"*aws-mfa*"
"aws-mfa"
"--force")))
(set-process-sentinel
proc
(make-success-err-msg-sentinel "*aws-mfa*"
"AWS MFA succeeded"
"AWS MFA failed, check *aws-mfa* buffer for details"))
(process-send-string proc (concat mfa-token "\n"))))
(with-eval-after-load 'kubernetes
(general-def kubernetes-overview-mode-map "m" #'aws-mfa))
#+END_SRC
** 1Password
#+BEGIN_SRC emacs-lisp
(defvar op-token nil