{"id":15763405,"url":"https://github.com/peter-evans/cloud-shell","last_synced_at":"2026-05-18T03:31:58.942Z","repository":{"id":77843041,"uuid":"150846380","full_name":"peter-evans/cloud-shell","owner":"peter-evans","description":"A fast and convenient way to spin up a shell in the cloud","archived":false,"fork":false,"pushed_at":"2018-10-20T13:28:12.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-05T11:41:51.813Z","etag":null,"topics":["ansible","ansible-playbooks","cloud-shell","gcp","googlecloudplatform","packer"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-evans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-29T09:06:41.000Z","updated_at":"2018-10-20T13:28:13.000Z","dependencies_parsed_at":"2023-04-27T19:03:54.112Z","dependency_job_id":null,"html_url":"https://github.com/peter-evans/cloud-shell","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/peter-evans/cloud-shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fcloud-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fcloud-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fcloud-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fcloud-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-evans","download_url":"https://codeload.github.com/peter-evans/cloud-shell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fcloud-shell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274589627,"owners_count":25312971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-playbooks","cloud-shell","gcp","googlecloudplatform","packer"],"created_at":"2024-10-04T11:41:51.671Z","updated_at":"2026-05-18T03:31:53.924Z","avatar_url":"https://github.com/peter-evans.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloud-shell\n\nThis is tooling to provide a fast and convenient way to spin up a shell in the cloud.\n\n## Features\n\n- Custom shell image with [Packer](https://www.packer.io) and [Ansible](https://www.ansible.com/)\n- Easily customise the image with additional [Ansible Galaxy](https://galaxy.ansible.com/) roles\n- Edit files on the remote machine using [rmate for TextMate 2](https://github.com/sclukey/rmate-python)\n- Forward local ssh key for use with git \n\n## Build\n\nThe image must first be built and stored in the desired GCP zone.\n\n**Prerequisites:**\n- [gcloud](https://cloud.google.com/sdk/gcloud/) must be installed and set to an account with the `roles/owner` role.\n- Ansible must be installed. See [here](https://docs.ansible.com/ansible/2.5/installation_guide/intro_installation.html) for full installation instructions.\n  - Mac OSX: `brew install ansible`\n\n**Build the image:**\n1. Edit [cloud-shell.cfg](cloud-shell.cfg) and set your GCP project ID and zone. Other configuration is optional.\n    ```bash\n    PROJECT_ID=\"cloud-shell-215704\"\n    ZONE=\"asia-northeast1-a\"\n    ```\n\n2. Execute the following script to create a Google Cloud service account for Packer. It will be created with the `compute.instanceAdmin.v1` and `iam.serviceAccountUser` roles.\n    ```bash\n    ./create_packer_service_account.sh\n    ```\n\n3. (Optional) Customise the shell image by, for example, adding [Ansible Galaxy](https://galaxy.ansible.com/) roles.\n\n4. Prepare the required ansible roles locally.\n    ```bash\n    ansible-galaxy install -r requirements.yml\n    ```\n\n5. Build and store the image in GCP.\n    ```bash\n    ./build.sh\n    ```\n\n## Usage\n\nLaunch a shell:\n```bash\n./cloud-shell.sh up\n```\n\nSSH to the virtual machine:\n```\n./cloud-shell.sh ssh\n```\n\nDelete the virtual machine:\n```\n./cloud-shell.sh down\n```\n\n## rmate\n\nThe default image comes with `rmate` installed allowing editing of files on the remote machine.\nOn your local machine you need to have an extension/plugin for your editor that supports Textmate's 'rmate' feature. Here are a couple of options:\n\n- Visual Studio Code: [Remote VSCode](https://github.com/rafaelmaiolla/remote-vscode)\n- Sublime Text: [RemoteSubl](https://github.com/randy3k/RemoteSubl)\n\n#### Usage with Remote VSCode\n\n1. Install the `Remote VSCode` extension.\n2. Open the command palette (CTRL+P for Windows and CMD+P for Mac) then execute the `\u003eRemote: Start Server` command.\n3. SSH to the remote machine with `./cloud-shell.sh ssh`\n4. Open remote files in Visual Studio Code with the command `rmate my-file.txt`\n\n## SSH Agent Forwarding\n\nThis will allow use of your local SSH keys by the remote machine.\nFor example, if you have an SSH key that you have authorised access to your GitHub account it will be usable on the remote machine.\n\nAdd the following configuration to `~/.ssh/config` if you would like your local ssh key to be forwarded to the remote host.\nThe `\u003cip address\u003e` is the IP of the virtual machine displayed after executing `./cloud-shell.sh up`.\n```\nHost \u003cip address\u003e\n ForwardAgent yes\n```\n\nOnce connected via ssh test the connection to GitHub:\n```bash\nssh -T git@github.com\n```\n\n## Known Issues\n\nThe following error message when building is due to the [Too many SSH keys](https://www.packer.io/docs/provisioners/ansible.html#too-many-ssh-keys) issue.\n```\ngooglecompute: fatal: [default]: UNREACHABLE! =\u003e {\"changed\": false, \"msg\": \"Failed to connect to the host via ssh: Warning: Permanently added '[127.0.0.1]:54452' (RSA) to the list of known hosts.\\r\\nReceived disconnect from 127.0.0.1 port 54452:2: too many authentication failures\\r\\nAuthentication failed.\\r\\n\", \"unreachable\": true}\n```\nIt can be fixed by clearing all keys from your ssh-agent.\n```\n$ ssh-add -D\n```\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fcloud-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-evans%2Fcloud-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fcloud-shell/lists"}