Skip to content

Latest commit

 

History

History
101 lines (77 loc) · 3.59 KB

README.md

File metadata and controls

101 lines (77 loc) · 3.59 KB

This is the cs90 final project repository

Install and configure git
For this project I launched an aws linux ec2 instance and sshed to it.
Note: this could be installed locally on a mac or windows machine.
mkdir final
cd final

Create an ssh public and private key pair for use with github.com

ssh-keygen -C email address 
ls ~/.ssh
cat ~/.ssh/id_rsa.pub

ssh-add KEPT GETTING ERRORS so i found the solution (next two steps) here:

ssh-agent
eval $(ssh-agent)
ssh-add

Next create a github account and add your public key to it (id_rsa.pub)

Install git using: sudo yum git install -y

Then initialize git: git init

Then configure git:

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Create a repository in your github.com with a README.md file.

Then clone it to the local machine (in our case ec2)
git clone [email protected]:ChadCottle/cs90.git
cd cs90
cat README.md

Open up README.md and make some changes in markdown language.
vi README.md

git status
git add .
git status
git commit -m "First commit"
git push

Create Roles first

First we will create some IAM roles.
We need a role for our ec2 instance(s) and a role for the Code Deploy service.

  1. Create a role called CDInstanceRole
    Attach the following policies:
    AmazonEC2RoleforAWSCodeDeploy
    AutoScalingNotificationAccessRole

  2. Create a role called CDServiceRole Attach the following policy:
    AWSCodeDeployRole
    Note: on the Trust Relationship tab you will need to edit this line:
    ”Service": “ec2.amazonaws.com” and change it to the following: ”Service": “codedeploy.amazonaws.com"

Create our initial ec2 instance that will run our web application

Choose a region that will run an instance as well as CD and CP
Launch a simple aws linux app within a VPC’s public subnet
Auto-assign a public IP
Choose our IAM role that was created earlier for instances: CDInstanceRole

Under Advanced Details add the following in the user data section:
#!/bin/bash
sudo yum update -y
sudo yum install httpd -y
sudo yum install ruby -y
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service httpd start
sudo chkconfig httpd on

Note: Link to userdata.txt

Here’s what is going on with the user data section. We are doing a standard update followed by installing apache (httpd). We then install ruby and wget the codedeploy agent and codedeploy resource kit from a bucket in our region. The bucket choices are listed here. Then we make it executable and install it. And lastly we are starting Apache and setting it to come back up after a reboot.

Code Deploy and Code Pipeline


Here is where we get into the meet of our project. We will follow these general steps for **Code Deploy**
  1. Create an application
  2. Create a deployment group
  3. Create a deployment

For this section we will also use the AWSCodeDeployRole we created earlier.