spotty-cloud / spotty

Training deep learning models on AWS and GCP instances
https://spotty.cloud
MIT License
491 stars 43 forks source link

Error while trying to ssh into instance using spotty #125

Closed Programmer-yar closed 1 year ago

Programmer-yar commented 1 year ago

I have been launching instances on AWS using spotty Previously, I have been able to ssh into instances using spotty. But I am getting the error: Permission denied (publickey). from yesterday. The only notable thing that I remember doing before I started getting this error was to switch IAM user from one AWS account to another in AWS CLI. I switched back to the IAM user I use to launch instances. Looking forward for guidance on this issue

apls777 commented 1 year ago

Typically this issue occurs when you run the same EC2 instance from another machine or under another local user.

When you start an instance with your spotty.yamlfor the first time:

  1. Spotty creates an EC2 Key Pair in your AWS account (the key name is based on the project name in spotty.yaml)
  2. It saves the private key locally in your home directory (~/.spotty/keys/).

Then, if you try to start an instance using the same spotty.yaml, but from another machine or under another user:

  1. Spotty will check that there is no private key saved locally.
  2. It will rewrite the EC2 Key Pair in your AWS account and save your new private key in the home directory.

As a result, if you will try to run an instance from the previous machine or user, it won't work because that user has the old private key that doesn't match the public key in AWS.

I guess, it's the same in your case but with IAM users. If you tried to run an instance using the second IAM user, Spotty hasn't found the EC2 Key Pair there and overwrote your local private key, so it doesn't work with the EC2 Key Pair from the previous account anymore. Just remove either EC2 Key Pair in your AWS account or your local private key in ~/.spotty/keys/ directory and it should work.

Programmer-yar commented 1 year ago

Yes, you are right This was the case actually. Sorry, I forgot to update the status on this issue I am very grateful to you @apls777

githubacct0 commented 1 year ago

Don't use @Programmer-yar It's a scammer

githubacct0 commented 1 year ago

@apls777 Ahmad is not a solo dev. He didn't pay me.