Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Quark! Quark! Beware the quantum duck!


devel / comp.lang.python / how to connect linux aws ec2 instance to windows local machine at my home using paramiko

SubjectAuthor
o how to connect linux aws ec2 instance to windows local machine at myKashish Naqvi

1
how to connect linux aws ec2 instance to windows local machine at my home using paramiko

<60050671-39ff-4d68-a1d0-5a3363ff9f3bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24538&group=comp.lang.python#24538

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a05:6214:598b:b0:67a:4562:b8d0 with SMTP id qp11-20020a056214598b00b0067a4562b8d0mr9065qvb.3.1701001125741;
Sun, 26 Nov 2023 04:18:45 -0800 (PST)
X-Received: by 2002:a4a:e582:0:b0:58d:54e8:5702 with SMTP id
o2-20020a4ae582000000b0058d54e85702mr303333oov.0.1701001125409; Sun, 26 Nov
2023 04:18:45 -0800 (PST)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Sun, 26 Nov 2023 04:18:45 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2405:201:3e:e804:294b:303b:bc09:de9a;
posting-account=oaRvKQoAAABYmbePBWy8mn6XJBbxG0bp
NNTP-Posting-Host: 2405:201:3e:e804:294b:303b:bc09:de9a
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <60050671-39ff-4d68-a1d0-5a3363ff9f3bn@googlegroups.com>
Subject: how to connect linux aws ec2 instance to windows local machine at my
home using paramiko
From: just.kas...@gmail.com (Kashish Naqvi)
Injection-Date: Sun, 26 Nov 2023 12:18:45 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Kashish Naqvi - Sun, 26 Nov 2023 12:18 UTC

I have a north viriginia ec2 linux instance and a windows machine at my home, how do I connec tthem?

import paramiko
import time

def run_scripts():
# Set your local machine's SSH details
local_machine_ip = ' '
username = 'justk'
private_key_path = 'C:/Users/justk/.ssh/kashish'
print("Connected 1", private_key_path)

# Create an SSH client
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print("Connected 2.2")

try:
# Connect to the local machine
ssh.connect(local_machine_ip, username=username, key_filename=private_key_path,password='abc')
print("Connected 2")

# Stop the first script: check_messages.py
stop_check_messages_command = 'pkill -f python C:/Project/pipeline-deployment/check_messages.py'
ssh.exec_command(stop_check_messages_command)
print("Connected 3")

# Stop the second script: manage.py runserver
stop_runserver_command = 'pkill -f "python C:/Project/pipeline-deployment/manage.py runserver'
ssh.exec_command(stop_runserver_command)

print("Waiting for 5 seconds before starting scripts...")
time.sleep(60)

# Run the first script: check_messages.py
check_messages_command = 'python C:/Project/pipeline-deployment/check_messages.py'
stdin, stdout, stderr = ssh.exec_command(check_messages_command)
print(f"Output of check_messages.py:\n{stdout.read().decode('utf-8')}")

# Run the second script: manage.py runserver
runserver_command = 'python C:/Project/pipeline-deployment/manage.py runserver'
stdin, stdout, stderr = ssh.exec_command(runserver_command)
print(f"Output of manage.py runserver:\n{stdout.read().decode('utf-8')}")

# Wait for 60 seconds
print("Waiting for 60 seconds...")
time.sleep(60)

# Run the third script: restart.py
restart_command = 'python C:/Project/pipeline-deployment/restartworkersbutton.py'
stdin, stdout, stderr = ssh.exec_command(restart_command)
print(f"Output of restart.py:\n{stdout.read().decode('utf-8')}")

except Exception as e:
print(f"Error: {e}")

finally:
# Close the SSH connection
ssh.close()

if __name__ == "__main__":
run_scripts()

i used this but i am unable to know what ip address to use?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor