{"id":21881917,"url":"https://github.com/shgtkshruch/ssh-connection-with-session-manager","last_synced_at":"2025-04-15T05:53:17.978Z","repository":{"id":49269965,"uuid":"239099823","full_name":"shgtkshruch/ssh-connection-with-session-manager","owner":"shgtkshruch","description":"Access AWS resources with Session Manager","archived":false,"fork":false,"pushed_at":"2021-06-21T05:21:51.000Z","size":891,"stargazers_count":5,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T05:53:12.511Z","etag":null,"topics":["aws","capistrano","rails","security","session-manager","terraform"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shgtkshruch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-08T09:22:49.000Z","updated_at":"2025-02-12T02:40:09.000Z","dependencies_parsed_at":"2022-09-12T13:40:23.316Z","dependency_job_id":null,"html_url":"https://github.com/shgtkshruch/ssh-connection-with-session-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgtkshruch%2Fssh-connection-with-session-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgtkshruch%2Fssh-connection-with-session-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgtkshruch%2Fssh-connection-with-session-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgtkshruch%2Fssh-connection-with-session-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shgtkshruch","download_url":"https://codeload.github.com/shgtkshruch/ssh-connection-with-session-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016319,"owners_count":21198832,"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","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":["aws","capistrano","rails","security","session-manager","terraform"],"created_at":"2024-11-28T09:25:47.755Z","updated_at":"2025-04-15T05:53:17.961Z","avatar_url":"https://github.com/shgtkshruch.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSH connection with Session Manager\n\nAccess AWS resources with Session Manager.\n\n## Create AWS Resources by Terraform\n\n```sh\ndocker-compose run terraform plan\n\ndocker-compose run terraform apply\n```\n\n## Settings\n\n### Install AWS CLI\n\n```sh\ncurl \"https://d1vvhvl2y92vvt.cloudfront.net/AWSCLIV2.pkg\" -o \"AWSCLIV2.pkg\"\nsudo installer -pkg AWSCLIV2.pkg -target /\n```\n\nConfirming the installation.\n\n```sh\nwhich aws\naws --version\n```\n\nref: [Installing the AWS CLI version 2 on MacOS - AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html)\n\n### Configure\n\nConfigure iam user created by Terraform.  \nAccess Key and Secret Access Key will be written to the terraform state file (`terraform.tfstate`), please protect your backend state file judiciously.\n\nref: https://www.terraform.io/docs/providers/aws/r/iam_access_key.html\n\n```sh\naws configure\n```\n\nref: [Configuring the AWS CLI - AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)\n\n\n### Install Session Manager Plugin\n\n```sh\ncurl \"https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/sessionmanager-bundle.zip\" -o \"sessionmanager-bundle.zip\"\nunzip sessionmanager-bundle.zip\nsudo ./sessionmanager-bundle/install -i /usr/local/sessionmanagerplugin -b /usr/local/bin/session-manager-plugin\n```\nref: [(Optional) Install the Session Manager Plugin for the AWS CLI - AWS Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html#install-plugin-macos)\n\n## Starting a Session (AWS CLI)\n\n```sh\naws ssm start-session --target instance-id\n```\n\nref: [Start a Session - AWS Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html)\n\n## Capistrano\nDeploy Rails applicaiton by capistrano throught Session Manager.  \nAdd proxy command settiongs below.\n\n```\nrequire 'net/ssh/proxy/command'\nset :ssh_options,\n    keys: %w[YOURE_SSH_KEY],\n    forward_agent: true,\n    auth_methods: %w[publickey],\n    proxy: Net::SSH::Proxy::Command::new(\"aws ssm start-session --target #{ENV['INSTANCE_ID']} --document-name AWS-StartSSHSession --parameters 'portNumber=22'\")\n ```\n \n ref: [Authentication \u0026 Authorisation - Capistrano](https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshgtkshruch%2Fssh-connection-with-session-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshgtkshruch%2Fssh-connection-with-session-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshgtkshruch%2Fssh-connection-with-session-manager/lists"}