When I create an EC2 Ubuntu instance on AWS, it generates a key pair. Then it has me download the private key from that key pair. I use that private key with ssh -i
to connect to the EC2 instance.
To use AWS CodeCommit, AWS asks me to create a key pair on my machine using ssh-keygen
. Why do I want two keys? Why doesn't AWS generate the key pair? Can this key pair be used with connecting to other (non-AWS) entities? Can I use a key pair that I generated for connections to a non-AWS entity to connect to AWS CodeCommit?
Why is there a difference between these two SSH-setup approaches and are these approaches interchangeable?