https://github.com/davidjeddy/aws_ec2_access_to_codecommit
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.
https://github.com/davidjeddy/aws_ec2_access_to_codecommit
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/davidjeddy/aws_ec2_access_to_codecommit
- Owner: davidjeddy
- Created: 2019-03-29T21:45:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T22:41:05.000Z (about 6 years ago)
- Last Synced: 2025-01-16T11:33:21.545Z (5 months ago)
- Language: HCL
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
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](https://github.com/Kulasangar/terraform-demo.git).
## Resoures
- [How to clone AWS CodeCommit repository from EC2 instance](https://blog.0x427567.com/2016/08/13/How-to-clone-AWS-CodeCommit-repository-from-EC2-instance/)
- [Kulasangar/terraform-demo](https://github.com/Kulasangar/terraform-demo)
- [Creating and attaching an AWS IAM role, with a policy to an EC2 instance using Terraform scripts](https://medium.com/@kulasangar91/creating-and-attaching-an-aws-iam-role-with-a-policy-to-an-ec2-instance-using-terraform-scripts-aa85f3e6dfff)## Requirements
- [Terminal](https://www.howtogeek.com/140679/beginner-geek-how-to-start-using-the-linux-terminal/)
- [SSH](https://en.wikipedia.org/wiki/Secure_Shell)
- [AWS account](http://aws.amazon.com)
- [AWS CLI API keys](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-setup-api-key-with-console.html)
- [Terraform](https://www.terraform.io/)## Usage
Open a terminal, [then](https://www.youtube.com/channel/UCPSfjD7o1CQZXzdAy56c8kg?pbjreload=10)
``` bash
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.
```bash
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.