Giter VIP home page Giter VIP logo

sample-aws's Introduction

sample-aws

Terraform implementation of a vulnerable infrastructure in AWS.

Uses community modules from the terraform-aws-modules project.

Usage

Create a keypair in the AWS Console (EC2 > Network & Security > Key Pairs).

Create the file terraform.tfvars, and add your keypair name:

key_name = "<YOUR KEYPAIR NAME>"

Other variables found in variables.tf can be customized in terraform.tfvars as well.

Run standard Terraform setup:

terraform init
terraform plan
terraform apply -auto-approve

Terraform will build the following:

  • VPC
  • Security Groups (accessible from 0.0.0.0/0)
  • MongoDB instance (with over-permissive IAM roles)
  • S3 Bucket (globally accessible)
  • EKS cluster running Jenkins Helm chart

This can take 20-30 minutes. Once done, you can log in to the MongoDB instance as ubuntu using the SSH key you created:

ssh -i <your ssh key file> ubuntu@<your mongodb instance>

For the Kubernetes cluster and the Jenkins deployment, first pull the kubeconfig from the created cluster:

export KUBECONFIG=~/.kube/config-sample-aws
aws eks update-kubeconfig --name sample-aws-eks-cluster --region us-east-1

Verify connectivity using kubectl get nodes:

NAME                          STATUS   ROLES    AGE    VERSION
ip-10-0-10-131.ec2.internal   Ready    <none>   139m   v1.21.14-eks-ba74326
ip-10-0-11-77.ec2.internal    Ready    <none>   139m   v1.21.14-eks-ba74326

Get the admin password of Jenkins with:

kubectl exec --namespace default -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo

Get the IP address of the created load balancer with kubectl get svc --namespace default jenkins

NAME      TYPE           CLUSTER-IP     EXTERNAL-IP                                                                     PORT(S)          AGE
jenkins   LoadBalancer   172.20.22.93   ad10bd28b6d0a47e5ba86fa2ec26e588-5b6d630a56b225a3.elb.us-east-1.amazonaws.com   8080:31997/TCP   3m7s

The Jenkins UI will be at http://:8080. You can login with admin and the password you retrieved above.

sample-aws's People

Contributors

mrichardson03 avatar dependabot[bot] avatar matts-wiz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.