Git Product home page Git Product logo

aws-devops-end-to-end's Introduction

AWS-DevOps-end-to-end

End-to-end project deployment of an application using CodeCommit, CodeArtifact, CodeBuild, CodeDeploy, CodePipeline.

Steps:

  1. Create a IAM user with "CodecommitPowerUser" and "IAMUserChangePassword" permission

  2. Create a user and download the .csv file

  3. Open your created user and go to security tab and scrool down and generate HTTPS Git credentials for AWS CodeCommit and save the file.

  4. Create a new instance

  5. Open terminal

  6. $sudo su

  7. $apt-get update

  8. $git clone

  9. Go inside that directory

  10. Enter your username and password from the .csv file which u downloaded (codecommit_credentials)

  11. enter git commands: git status git add . git commit -m "first commit" git push origin master

  12. go to CodeCommit and check the file pushed

  13. Create a branch using "git checkout -b dev"

  14. create a new file and push the file in dev branch

  15. check CodeCommit and then click on Create pull request

  16. Complete the pull request and merge the branches. This Completes the CodeCommit Part

  17. Click on CodeBuild-> Create a build project

  18. Select the repo under sources

  19. For BuildSpec file, create a file in EC2 terminal. Find the file code below:

vi buildspec.yml version: 0.2

phases: install: commands: - echo Installing NGINX - sudo apt-get update - sudo apt-get install nginx -y

build: commands: - echo Build Started on $(date) - cp index.html /var/www/html/

post_build: commands: - echo Configuration NGINX

artifacts: files: - /var/www/html/index.html

git branch --> to know the working branch git checkout master--> to change the branch Note: If you get git error, type this commands,

  1. git pull origin master

  2. git config --global pull.rebase true

  3. git pull origin master

  4. git push origin master

  5. Create CodeBuild

  6. Click on Start Build

  7. After your project is built successful , then go to build projects

  8. select the project--> edit--> artifact

image

Follow these steps and go further.

Here completes your CodeBuild part.

Now go further for CodeDeploy part.

  1. Click on CodeDeploy
  2. Create a new application
  3. And select cloud platform as EC2
  4. next create a deployment group
  5. Create an IAM role with below mentioned permissions:

AmazonS3FullAccess AmazonEC2RoleforAWSCodeDeployLimited AWSCodeDeployRole AWSCodeDeployFullAccess AmazonEC2RoleforAWSCodeDeploy AmazonEC2FullAccess

after creating the role, go to trust relationship tab and edit the policy and add this new policy :

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "codedeploy.amazonaws.com", "ec2.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }

and save the role

  1. Copy the ARN of the iam role and paste it under service role in deployment group

  2. Select amazon EC2 instance under environment configuration

  3. launch an ec2 instance , and then come back to deployment group and add that ec2 instance name

  4. Uncheck the load balancer checkbox.

Finally deployment group is succesfully created.

Now you can go further.

Now connect to your old instance and ls buildspec.yml index.html sample.txt

  1. Create a new file vi appspec.yml version: 0.0 os: linux files:
  • source: / destination: /var/www/html hooks: AfterInstall:
    • location: script/install_nginx.sh timeout: 300 runas: root ApplicationStart:
    • location: script/start_nginx.sh timeout: 300 runas: root
  1. Create a directory mkdir scripts

vi install_nginx.sh

#!/bin/bash

sudo apt-get update sudo apt-get install -y nginx

vi start_nginx.sh

#!/bin/bash

sudo service nginx start

Save both the files and come back with cd ..

git status 3. and push all the files to CodeCommit

Now build your project again

  1. Go to CodeDeploy -> Create a deployment
  2. give the path of s3 zip file, and select zip
  3. create deployment
  4. Deployment will be in pending state

Create a new role ec2deployment with permissions: AmazonEC2FullAccess CodeDeployFullAccess S3FullAccess

  1. Now go back to your instance cat install.sh $sudo service codedeploy-agent restart

aws-devops-end-to-end's People

Contributors

arbin-banu avatar

Watchers

 avatar

Forkers

harshubig

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.