binbashburns / busybeecoffee-aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Busy Bee Coffee Web Store + CI/CD

Build a disposable, test EC2 instance running Amazon Linux 2 in Terraform that only allows SSH access.
Test a script, test User Data (bootstrap) script, an AMI you've created in Packer, or whatever you need.
main.tf is a flat Terraform configuration file that builds an EC2 instance with all dependencies necessary to SSH to it and lab.
This build will create an SSH keypair on the machine you run this Terraform code from.
A terraform destroy will nuke the instance, the VPC, the SSH keypair, and everything created from this build.

Prerequisites

Instructions

  • Clone this repo: git clone https://github.com/mattburns-coalburns/disposable-ec2.git
  • cd busybeecoffee
  • terraform init
  • terraform apply
  • Copy/paste the output into your terminal
  • When you're done: terraform destroy

Resources in this lab

  • VPC
  • Subnet
  • Internet Gateway
  • Route Table
  • Security Groups
  • EC2 Instance
  • RSA 4096 Keys

Build Docker container

  • cd app/src
  • If you're not sure how to build a Docker image manually, go to ECR. Click View Push Commands. It will tell you the steps which go like this:
  • Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI.: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <replace-with-account-ID>.dkr.ecr.<us-east-1>.amazonaws.com
  • Build your Docker image using the following command: docker build -t ecs-busybee-home .
  • After the build completes, tag your image so you can push the image to this repository: docker tag ecs-busybee-home:latest 764364320071.dkr.ecr.us-east-1.amazonaws.com/ecs-busybee-home:latest
  • Run the following command to push this image to your newly created AWS repository: docker push 764364320071.dkr.ecr.us-east-1.amazonaws.com/ecs-busybee-home:latest

About


Languages

Language:SCSS 30.5%Language:JavaScript 29.2%Language:CSS 26.5%Language:HTML 9.0%Language:HCL 4.0%Language:Python 0.7%Language:PHP 0.1%Language:Dockerfile 0.0%