Skip to content

Instantly share code, notes, and snippets.

@cmittendorf
Last active September 17, 2015 22:16
Show Gist options
  • Save cmittendorf/1dc152d95763f31a1ca0 to your computer and use it in GitHub Desktop.
Save cmittendorf/1dc152d95763f31a1ca0 to your computer and use it in GitHub Desktop.
An AppleScript to ssh with Terminal.app into the the currently selected server instance in the EC2 Management Console in Safari.app.
set aws to missing value
tell application "Safari"
tell current tab
set aws to do JavaScript "document.getElementsByClassName(\"AOB\")[0].textContent.match(/DNS: (.*\\.amazonaws\\.com)/)[1]"
end tell
end tell
if aws is not missing value then
tell application "Terminal"
activate
do script "ssh admin@" & aws
end tell
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment