AWS Code Commit Setup

This tutorial aims to get an IAM account setup to be able to use Code Commit. In summary I'm going to be:

  • Create IAM developer group with full permissions to access code commit.
  • Create IAM User and developer group.
  • Setting up SSH keys and configure SSH to use said keys.
  • Try a new repository

That said, lets get started.

Create IAM developer group with full permissions to access code commit.

  • Log into your account
  • Go to IAM > Groups > Create New Group
  • Create a group called Developers
  • Attach AWSCodeCommitFullAccess policy
  • Make sure you download the CSV file with all the given credentials or at least store it somewhere safe

Create IAM User and developer group.

  • Go to IAM > Users > Create New User
  • Create a user, I follow the pattern of first initial and last name (eg. jdoe)
  • Allow Programmatic access and AWS Management Console access
  • Let AWS to Autogenerated password
  • Make sure you require password reset
  • You should be able to see the Developer group you created previously make sure you assign it to the user.

Setting up SSH keys and configure SSH to use said keys.

  • Create your SSH keys by running ssh-keygen -t rsa -b 4096 -C "opposite.bracket@gmail.com"
  • name your ssh keys (eg. aws-id_rsa)
  • Go to AWS > IAM > Users
  • Select the user you created (eg jdoe)
  • Copy your public ssh key by running the following in your terminal pbcopy < ~/.ssh/aws-id_rsa in the terminal
  • Update user in AWS
  • Update your ~/.ssh/config with the following content:

Host git-codecommit.*.amazonaws.com
  AddKeysToAgent yes
  UseKeychain yes
  User {SSH key ID}
  IdentityFile ~/.ssh/aws-id_rsa

Try a new repository

  • Create a repository with your AWS CLI: aws codecommit create-repository --repository-name my-first-repo
  • Clone the repo git clone ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/my-first-repo
  • Change into repo cd my-first-repo
  • Create a README.md echo '#Provisioning' > README.md
  • commit git commit -am "make first commit"
  • push git push origin master

PROFIT!!!

TextMate + RVM

I'm testing out ruby using TextMate and seems like it's not picking up my RVM environment SO, here's what i found out.

After you have a functioning rvm setup, all you need to do is as follows:

  • Open your terminal (I use iTerm2) and run which rvm-auto-ruby which currently gives me /Users/psyco-mantis/.rvm/bin/rvm-auto-ruby.
  • Go to TextMate > Preferences > Variables and add a variable called TM_RUBY and assign the path given in the previous step (Mine was /Users/psyco-mantis/.rvm/bin/rvm-auto-ruby).

Profit!, now if you create a file with puts RUBY_VERSION as the content, you'll see your RVM's ruby version.

NVM / Bash / OSX installation on Mac

The purpose for this post is simple, get RVM installed so that i can get back to it whenever i format my computer and believe me, it happens very often.

This is actually quite simple - First, make sure you've got HomeBrew installed, then run:

brew update
brew install nvm

and include the following:

# Node Version Manager
export NVM_DIR="$HOME/.nvm"
source "/usr/local/opt/nvm/nvm.sh"

so that my nvm is available as needed and since i don't have a python requirement at work, i'll simply use the latest:

nvm install v6.11.2

There's one thing that bother's me and that is that now, when i open a bash session it takes quite a bit si instead of loading nvm, i'm just going to use the path to my current installation by replacing the bash code i said you should add with this:

export PATH="$PATH:$HOME/.nvm/versions/node/v6.11.2/bin"

THE END!

GitHub – opposite-bracket

Jesus Rodriguez

Vancouver, BC