t2.micro size use your default VPC, or a VPC with a public subnet
development Userdata
#!/bin/bash
sudo yum update -y
sudo yum install wget -y
sudo yum install git -y
QA Userdata
#!/bin/bash
sudo yum update -y
sudo yum install git -y
sudo yum install ruby -y
sudo yum install wget -y
Tags
- name = development
- name = QA
Create a security group for 22 and 8080 available to the internet
Use a new keypair or a keypair that you have access to
ssh into the instance
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install node
nvm --version
wget https://github.com/timjbruce/AccountLookup/blob/master/AccountLookup.zip
a) EC2 service - AWSCodeCommitFullAccess policy - AmazonDynamoDBFullAccess policy - Role Name: EC2MeetupLabCommit - attach the role to your EC2 development instance
b) EC2 service - AWSCodeDeployRole - AmazonDynamoDBFullAccess - AmazonS3FullAccess - Role Name: EC2MeetupLabDeploy - attach the role to your EC2 QA instance
c) CodeDeploy Service Role - AWSCodeDeployRole - Name: CDMeetupLab
Go to CodeCommit Name: {yourname}AccountLookup Description: Simple account lookup tool
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
git clone https://git-codecommit.us-west-1.amazonaws.com/v1/repos/{yourname}AccountLookup
cd ~/{yourname}AccountLookup
unzip ~/AccountLookup.zip
nano server.js and update your region for dynamo
Table Name: Accounts PartitionKey: AccountNumber {Number}
Add a record: AccountNumber:1, String: Name:{YourName}, Number: Amount:{somevalue}
npm init
accountlookup
1.0.0
Account lookup tool
server.js
npm install aws-sdk
npm install express
npm install body-parser
npm install ejs
start the app by typing "npm start" go to a browser and type in your development instanceip address:8080 control+c will end the program
git add *
git commit -m "Initial Checkin"
git push origin master
Everything is now in CodeCommit!
wget https://aws-codedeploy-us-west-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
Go to CodeDeploy in the Console and click Get Started
- Custom Deployment
- Application Name: AcctLookup
- Deployment Group Name: QA
- Amazon EC2 Instances: Key: Name, Value: QA
- Role - CDMeetupLab
- Create Application
Go to CodePipeline in the Console and click Get Started
- Name: AccountLookup
- Source Provider: "AWS CodeCommit"
- Repository Name: {yourname}AccountLookup
- Branch: Master
- Change Detection: CloudWatch Event
- Build Provider: No build
- Deploy Provider: AWS CodeDeploy
- Application Name: AcctLookup
- Deployment Group: QA
- Create Role -> Click Allow
- Click Next Step
- Click Create Pipeline
Watch the steps go from "No executions yet" to "In Progress" Wait until your staging deployment is complete