Set up an AWS CodeCommit repo and use IAM GitCredentials to perform git actions as an IAM User
Setting up a repository in AWS CodeCommit
In the search bar of the AWS Management Console, search for CodeCommit. Click on Create Repository, name your repo, and write a description for it, though it's optional. Click Create.
Now, search for IAM. Create a user, allow permissions to AWS Management Console, and click on Attach Policies Directly to allow permissions to the IAM User. In the search bar for permission policies, allow CodeCommitPowerUser to the IAM user. Now your user is finally created after reviewing the information provided by you.
After the user is created, click on the user, switch to the Security Credentials tab, scroll down, search for HTTPS Git credentials for AWS CodeCommit, and click on Generate Credentials. Download the file for credentials.
Return to the CodeCommit screen, click on Clone URL, and select HTTPS. Open your terminal or default terminal, and follow the commands :
git clone <https://url>
As you try to use the given command, a window pops up and requests credentials such as username and password. The downloaded git credentials file contains both of them. Enter the username and password, and cloning starts.
After the repo you created gets cloned into your local, add any file of your choice to the repo and follow these commands :
git add <file_name>
git push origin master
Refresh the screen of CodeCommit and open your repo to check that file(s) you added locally has been pushed to your created repository.