Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/babakdoraniarab/terraform_aws_ec2_jenkins_ansible
if you want to have a EC2 and install Jenkins on it, clone and run this code
https://github.com/babakdoraniarab/terraform_aws_ec2_jenkins_ansible
ansible aws ec2 jenkins terraform-aws
Last synced: 3 months ago
JSON representation
if you want to have a EC2 and install Jenkins on it, clone and run this code
- Host: GitHub
- URL: https://github.com/babakdoraniarab/terraform_aws_ec2_jenkins_ansible
- Owner: babakDoraniArab
- Created: 2022-02-05T16:02:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T16:18:04.000Z (about 3 years ago)
- Last Synced: 2023-03-06T09:32:54.385Z (almost 2 years ago)
- Topics: ansible, aws, ec2, jenkins, terraform-aws
- Language: HCL
- Homepage:
- Size: 6.84 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Security: security-group.tf
Awesome Lists containing this project
README
# how to use
you can have your own key.I have a Demo.pem key and I've download it before.ok!first of all clone and run the below commands
`terraform init``terraform mft`
`terraform validate`
`terraform plan`
`terraform apply`
now you have your public_dns copy that and go to your `~/.ssh/config` file
and make your connection like this
```
Host jenkins
Hostname ec2-11-222-333-62.eu-west-1.compute.amazonaws.com
user ubuntu
IdentityFile ~/Downloads/Demo.pem
```as you can see I've used my Demo.pem
## if you want to see your instances with AWS CLI use the following command
```
aws ec2 describe-instances --query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Id:InstasnceId,PrivateIP:PrivateIpAddress,Name:Tags[?Key=='Name']|[0].Value,Type:InstanceType,Status:State.Name,VpcId:VpcId}" --filters Name=instance-state-name,Values=running --output table```
## you can start and stop your machine with the following AWS_CLI command
`aws ec2 start-instances --instance-ids i-yourInstanceId `
`aws ec2 stop-instances --instance-ids i-yourInstanceId`