cancel
Showing results for 
Search instead for 
Did you mean: 

What is the efficient way of using AWS codeDeploy via GitHub webhook ?

What is the efficient way of using AWS codeDeploy via GitHub webhook ?

Can u please suggest me how effective i can use AWS codeDeploy plugin to deploy code automatically from GitHub?
Is there any problems i need to overcome?

1 REPLY 1

Re: What is the efficient way of using AWS codeDeploy via GitHub webhook ?

I found the way to use AWS code deploy for Magento application. Take a look on the below documentation.

AWS Codedeploy BG Deployment

AMI

We’re using Amazon Machine Image to create a backup of the whole system configuration(Magento setup). We’ll use it in launch configuration.

IAM Role

  • We’ll setup two IAM roles. One for codedeploy to Communicate with EC2 instances and other for EC2 instance to access s3.

Load Balancing

  • We will create the application load balancing.

Auto Scaling Group

Launch Configuration:

  • Choose the created AMI
  • Select the IAM role which we have created for the EC2 instance

 

Auto Scaling Group:

  • Select the Launch Configuration
  • Adjust the capacity of this group by specifying the minimum and maximum size of your group as 1 to 3 for scaling the instances depending upon traffic.

CodeDeploy: 
CD1.png

                                        Fig-2: Deployment Group Screen

  • Fig-2 will show how to setup the Deployment type and Environment configuration.
  • Specify Deployment group name, choose Deployment type and Environment configuration as in the above image.
  • Choose the created auto scaling group. 
  • Choose the Load Balancer type and target group as shown in above image
  • Click the Edit deployment settings to get the popup as below image 
  • Review the configuration and complete the wizard.

CodePipeline:

  • First we will connect our Github repository as a source for the pipeline.
  • We’ll skip the Build step.
  • Choose the created CodeDeploy Application in Deploy step.
  • Review the configuration and complete the wizard.

How Deployment Works:

AWS-CD.jpg
                                        Fig-5: Code Deployment Architecture

  • Include CodeDeploy events such as Before-Install, Install, After-Install with required changes in your local code base and commit the changes to Github.
  • In the Replacement Environment, the CodeDeploy will search for the committed appspec.yml file.
  • After recognising the appspec.yml file, It’ll start executing the following events:
    • Before-Install
    • Install
    • After-Install
    • We’ll include Unit test cases in After Install event.
  • After its successful completion, now the latest version will be available on Replacement Environment.
  • This Replacement Environment will be Added to the New Auto Scaling Group automatically.
  • Newly created Auto Scaling Group will be added to the Existing Load Balancer.
  • The Traffic will be Rerouted to the Replacement Environment.
  • Original Environment will be terminated.