To connect to AWS CodeCommit via SSH, you cannot use the root user. Therefore, you need to create a new IAM user. Here are the steps:
From the AWS Console, select IAM.
Choose “Add Users” under “User Management.”
Click “Add User.”
Set the user details and select the type of AWS access. In this case, since it’s for personal use, configure it to be as similar to the root user as possible.
Next, assign access permissions. For this example, use an existing policy. Since it’s for personal use, select “Administrator Access.”
Once the settings are complete, you can confirm that the attached policy is displayed as “Administrator Access.”
Add the user. The result should look like this:
When the user is successfully added, a password will be issued. Make sure to save it. You can also download it as a CSV file.
Users with access rights to the AWS Management Console can sign in using the provided credentials. Test the access by logging in. You will be prompted to set a new password.
Since security has been strengthened, let’s also set up two-factor authentication using MFA.
From the user, go to authentication information and select “Assign MFA Device.” Initially, it will likely be set to “No.”
I use AUTHY, so I selected a virtual MFA device.
Follow the instructions to complete the setup. Setting up two-factor authentication with MFA is recommended not only for IAM users but also for root users for added security.