Skip to content

Instantly share code, notes, and snippets.

@raymondbutcher
Last active March 17, 2024 20:33
Show Gist options
  • Save raymondbutcher/0570f3f037ccec40b1fc479925c7d743 to your computer and use it in GitHub Desktop.
Save raymondbutcher/0570f3f037ccec40b1fc479925c7d743 to your computer and use it in GitHub Desktop.

Revisions

  1. raymondbutcher revised this gist Oct 6, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions ssm-sshuttle.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,12 @@

    These are just rough notes, maybe I'll clean them up later.

    ## Set up

    https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html

    ## Usage

    ```
    # This is the instance we'll be using.
    INSTANCE_ID=i-0000000000
  2. raymondbutcher revised this gist Oct 6, 2020. 1 changed file with 5 additions and 14 deletions.
    19 changes: 5 additions & 14 deletions ssm-sshuttle.md
    Original file line number Diff line number Diff line change
    @@ -23,18 +23,9 @@ sshuttle --ssh-cmd="ssh -o ProxyCommand='sh -c \"aws ssm start-session --target

    ## Speed test

    With ssm-sshuttle:
    I went to https://www.speedtest.net/ to see how slow this was. It might be OK for light usage or debugging an issue, but it's pretty slow.

    ```
    Ping: 132ms
    Download Mbps: 3.64
    Upload Mbps: 1.22
    ```

    Without:

    ```
    Ping: 19ms
    Download Mbps: 305.44
    Upload Mbps: 51.47
    ```
    | Running ssm-sshuttle | Ping ms | Download Mbps | Upload Mbps |
    |----------------------|---------|---------------|-------------|
    | No | 19 | 305.44 | 51.47 |
    | Yes | 132 | 3.64 | 1.22 |
  3. raymondbutcher revised this gist Oct 6, 2020. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion ssm-sshuttle.md
    Original file line number Diff line number Diff line change
    @@ -23,8 +23,18 @@ sshuttle --ssh-cmd="ssh -o ProxyCommand='sh -c \"aws ssm start-session --target

    ## Speed test

    With ssm-sshuttle:

    ```
    Ping: 132ms
    Download Mbps: 3.64
    Upload Mbps: 1.22
    ```
    ```

    Without:

    ```
    Ping: 19ms
    Download Mbps: 305.44
    Upload Mbps: 51.47
    ```
  4. raymondbutcher revised this gist Oct 6, 2020. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions ssm-sshuttle.md
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,12 @@ aws ssm start-session --target $INSTANCE_ID
    # Then run sshuttle.
    sshuttle --ssh-cmd="ssh -o ProxyCommand='sh -c \"aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=22\"'" --remote ec2-user@$INSTANCE_ID $DNS_FLAG $VPC_CIDR
    ```

    ## Speed test

    ```
    Ping: 132ms
    Download Mbps: 3.64
    Upload Mbps: 1.22
    ```
  5. raymondbutcher created this gist Oct 6, 2020.
    22 changes: 22 additions & 0 deletions ssm-sshuttle.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # ssm-sshuttle

    These are just rough notes, maybe I'll clean them up later.

    ```
    # This is the instance we'll be using.
    INSTANCE_ID=i-0000000000
    # Set this to the VPC CIDR block, or use 0.0.0.0/0 to forward all traffic through the instance.
    VPC_CIDR=0.0.0.0/0
    # Use this flag to forward DNS through SSH (for split horizon DNS records)
    # If you don't need it for an environment, don't use it.
    DNS_FLAG=--dns
    # First add your ssh key to /home/ec2-user/.ssh/authorized_keys
    # TODO: come up with a one-liner to do it.
    aws ssm start-session --target $INSTANCE_ID
    # Then run sshuttle.
    sshuttle --ssh-cmd="ssh -o ProxyCommand='sh -c \"aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=22\"'" --remote ec2-user@$INSTANCE_ID $DNS_FLAG $VPC_CIDR
    ```