{"action":"created","comment":{"url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/comments/65732862","id":65732862,"diff_hunk":"@@ -344,6 +339,24 @@ find_centos_7_ami_ids() {\n   done\n }\n \n+shutdown_instances() {\n+  aws ec2 describe-instances --filters \"Name=instance-state-name,Values=running\" | jq -c -r '.Reservations[] .Instances[] .InstanceId' > instance_list\n+  echo \"You are about to terminate the following instances:\"\n+  cat instance_list\n+  read -r -p \"Are you sure? [y/N] \" response\n+  if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]\n+  then\n+    IFS=$'\\n'  # make newlines the separator\n+    for i in `cat ./instance_list`; do\n+      echo \"Shutting down $i\"\n+      aws ec2 terminate-instances --instance-ids $i\n+    done\n+  else\n+    echo \"Nothing shutdown, exiting...\"\n+  fi\n+  unset IFS","path":"bin/nbb","position":71,"original_position":71,"commit_id":"fbc4e426b1b71d79a0e212f2b5fb55fc35ee0fd4","original_commit_id":"fbc4e426b1b71d79a0e212f2b5fb55fc35ee0fd4","user":{"login":"jaustinhughey","id":421850,"avatar_url":"https://avatars.githubusercontent.com/u/421850?v=3","gravatar_id":"","url":"https://api.github.com/users/jaustinhughey","html_url":"https://github.com/jaustinhughey","followers_url":"https://api.github.com/users/jaustinhughey/followers","following_url":"https://api.github.com/users/jaustinhughey/following{/other_user}","gists_url":"https://api.github.com/users/jaustinhughey/gists{/gist_id}","starred_url":"https://api.github.com/users/jaustinhughey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaustinhughey/subscriptions","organizations_url":"https://api.github.com/users/jaustinhughey/orgs","repos_url":"https://api.github.com/users/jaustinhughey/repos","events_url":"https://api.github.com/users/jaustinhughey/events{/privacy}","received_events_url":"https://api.github.com/users/jaustinhughey/received_events","type":"User","site_admin":false},"body":"Suggestion: if the user passes in an argument like `--cleanup` when calling this command/function/wrapper, *automatically remove the generated instances list file for them* right here. Lets users keep their filesystem tidy if they don't care about having that point in time snapshot of state I mentioned above, and allows other users to keep that data if they so desire; all that's required is for the user to tell us how they want it. :smiley:","created_at":"2016-06-03T16:04:55Z","updated_at":"2016-06-03T16:04:55Z","html_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40#discussion_r65732862","pull_request_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/comments/65732862"},"html":{"href":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40#discussion_r65732862"},"pull_request":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40","id":72448559,"html_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40","diff_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40.diff","patch_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40.patch","issue_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/40","number":40,"state":"open","locked":false,"title":"Add Provider shutdown command","user":{"login":"7hunderbird","id":3761,"avatar_url":"https://avatars.githubusercontent.com/u/3761?v=3","gravatar_id":"","url":"https://api.github.com/users/7hunderbird","html_url":"https://github.com/7hunderbird","followers_url":"https://api.github.com/users/7hunderbird/followers","following_url":"https://api.github.com/users/7hunderbird/following{/other_user}","gists_url":"https://api.github.com/users/7hunderbird/gists{/gist_id}","starred_url":"https://api.github.com/users/7hunderbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/7hunderbird/subscriptions","organizations_url":"https://api.github.com/users/7hunderbird/orgs","repos_url":"https://api.github.com/users/7hunderbird/repos","events_url":"https://api.github.com/users/7hunderbird/events{/privacy}","received_events_url":"https://api.github.com/users/7hunderbird/received_events","type":"User","site_admin":false},"body":"This adds the command which paves the way for a `provider` encapsulation we can re-use.\r\n\r\nEssentially we want to make a command that is convenient and safe to terminate the servers currently running on EC2.\r\n\r\nThis is a first cut, we can add layers of control to it.  The \"meat\" of the search is:\r\n\r\n```\r\naws ec2 describe-instances --filters \"Name=instance-state-name,Values=running\" | jq -c -r '.Reservations[] .Instances[] .InstanceId' > instance_list\r\n```","created_at":"2016-06-03T03:16:07Z","updated_at":"2016-06-03T16:04:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01822cf9efcc44088d5ae5a55b033e4ebf2d8023","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40/commits","review_comments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40/comments","review_comment_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/40/comments","statuses_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/statuses/fbc4e426b1b71d79a0e212f2b5fb55fc35ee0fd4","head":{"label":"cloudfoundry-community:provider_shutdown","ref":"provider_shutdown","sha":"fbc4e426b1b71d79a0e212f2b5fb55fc35ee0fd4","user":{"login":"cloudfoundry-community","id":4378855,"avatar_url":"https://avatars.githubusercontent.com/u/4378855?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry-community","html_url":"https://github.com/cloudfoundry-community","followers_url":"https://api.github.com/users/cloudfoundry-community/followers","following_url":"https://api.github.com/users/cloudfoundry-community/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry-community/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry-community/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry-community/orgs","repos_url":"https://api.github.com/users/cloudfoundry-community/repos","events_url":"https://api.github.com/users/cloudfoundry-community/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry-community/received_events","type":"Organization","site_admin":false},"repo":{"id":53442281,"name":"aws-nat-bastion-bosh-cf","full_name":"cloudfoundry-community/aws-nat-bastion-bosh-cf","owner":{"login":"cloudfoundry-community","id":4378855,"avatar_url":"https://avatars.githubusercontent.com/u/4378855?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry-community","html_url":"https://github.com/cloudfoundry-community","followers_url":"https://api.github.com/users/cloudfoundry-community/followers","following_url":"https://api.github.com/users/cloudfoundry-community/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry-community/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry-community/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry-community/orgs","repos_url":"https://api.github.com/users/cloudfoundry-community/repos","events_url":"https://api.github.com/users/cloudfoundry-community/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry-community/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf","description":"AWS Nat + Bastion + BOSH Director + CF Deployment (using Terraform).","fork":false,"url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf","forks_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/forks","keys_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/teams","hooks_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/hooks","issue_events_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/events{/number}","events_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/events","assignees_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/assignees{/user}","branches_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/branches{/branch}","tags_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/tags","blobs_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/languages","stargazers_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/stargazers","contributors_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/contributors","subscribers_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/subscribers","subscription_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/subscription","commits_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/contents/{+path}","compare_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/merges","archive_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/downloads","issues_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues{/number}","pulls_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/labels{/name}","releases_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/releases{/id}","deployments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/deployments","created_at":"2016-03-08T20:18:18Z","updated_at":"2016-03-24T17:19:34Z","pushed_at":"2016-06-03T15:56:11Z","git_url":"git://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf.git","ssh_url":"git@github.com:cloudfoundry-community/aws-nat-bastion-bosh-cf.git","clone_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf.git","svn_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf","homepage":null,"size":1659,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":20,"forks":6,"open_issues":20,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudfoundry-community:master","ref":"master","sha":"c401564333df4228dc4618d525cc1e8695a45cd3","user":{"login":"cloudfoundry-community","id":4378855,"avatar_url":"https://avatars.githubusercontent.com/u/4378855?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry-community","html_url":"https://github.com/cloudfoundry-community","followers_url":"https://api.github.com/users/cloudfoundry-community/followers","following_url":"https://api.github.com/users/cloudfoundry-community/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry-community/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry-community/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry-community/orgs","repos_url":"https://api.github.com/users/cloudfoundry-community/repos","events_url":"https://api.github.com/users/cloudfoundry-community/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry-community/received_events","type":"Organization","site_admin":false},"repo":{"id":53442281,"name":"aws-nat-bastion-bosh-cf","full_name":"cloudfoundry-community/aws-nat-bastion-bosh-cf","owner":{"login":"cloudfoundry-community","id":4378855,"avatar_url":"https://avatars.githubusercontent.com/u/4378855?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry-community","html_url":"https://github.com/cloudfoundry-community","followers_url":"https://api.github.com/users/cloudfoundry-community/followers","following_url":"https://api.github.com/users/cloudfoundry-community/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry-community/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry-community/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry-community/orgs","repos_url":"https://api.github.com/users/cloudfoundry-community/repos","events_url":"https://api.github.com/users/cloudfoundry-community/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry-community/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf","description":"AWS Nat + Bastion + BOSH Director + CF Deployment (using Terraform).","fork":false,"url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf","forks_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/forks","keys_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/teams","hooks_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/hooks","issue_events_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/events{/number}","events_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/events","assignees_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/assignees{/user}","branches_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/branches{/branch}","tags_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/tags","blobs_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/languages","stargazers_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/stargazers","contributors_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/contributors","subscribers_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/subscribers","subscription_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/subscription","commits_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/contents/{+path}","compare_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/merges","archive_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/downloads","issues_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues{/number}","pulls_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/labels{/name}","releases_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/releases{/id}","deployments_url":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/deployments","created_at":"2016-03-08T20:18:18Z","updated_at":"2016-03-24T17:19:34Z","pushed_at":"2016-06-03T15:56:11Z","git_url":"git://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf.git","ssh_url":"git@github.com:cloudfoundry-community/aws-nat-bastion-bosh-cf.git","clone_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf.git","svn_url":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf","homepage":null,"size":1659,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":20,"forks":6,"open_issues":20,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40"},"html":{"href":"https://github.com/cloudfoundry-community/aws-nat-bastion-bosh-cf/pull/40"},"issue":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/40"},"comments":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/cloudfoundry-community/aws-nat-bastion-bosh-cf/statuses/fbc4e426b1b71d79a0e212f2b5fb55fc35ee0fd4"}}}}
{"actor":{"display_login":"jaustinhughey"}}