This contains simple terraform scripts, to create an iam role, an iam policy, spin up a new ec2 instance and attach the role to that instance.
This was completely done based on the samples provided in the official documentation of Terraform and Kulasanger's similar example.
- How to clone AWS CodeCommit repository from EC2 instance
- Creating and attaching an AWS IAM role, with a policy to an EC2 instance using Terraform scripts
Open a terminal, then
terraform init terraform plan terraform apply
Once Terraform has completed it will provide a
ssh command to log into the now started machine. Once logged in execute the below commands.
sudo su yum update -y yum install -y awscli git htop python-pip git config --global credential.helper '!aws codecommit credential-helper $@' git config --global credential.UseHttpPath true git clone ###HTTPS URL OF YOUR CODE COMMIT REPOSITORY###
Allow GiT to complete and you should now have access to your GiT repositories contents on the machine.