In this blog, you will discover how to build an automated software release pipeline that extends a live sample app. You will build the pipeline using AWS code pipeline, a service that creates, tests, and deploys your code each time there is a code modification. You will use your GitHub account, an amazon s3 bucket, or an AWS codecommit repository as the source position for the example app’s code. You will also use AWS elastic beanscode as the deployment point for the sample app. Your finished pipeline will be ready to identify modifications made to the source repository containing the sample app and then automatically modify your live sample app.
Continuous deployment enables you to expand revisions to a production background automatically without express approval from a developer, making the complete software release process automated.
How to Create a deployment environment?
Your constant deployment pipeline will need a destination environment containing virtual servers, or Amazon EC2 instances, where it will deploy sample code. You will make this environment before making the pipeline.
- To explain the method of setting up and configuring EC2 instances for this blog, you will turn up an example environment using AWS Elastic Beanstalk. Elastic Beanstalk lets you simply host web applications without wanting to launch, configure, or operate virtual servers on your personal. It automatically provisions and manages the infrastructure and gives the application stack for you.
- Prefer PHP from the drop-down list and then match Launch Now.
- Elastic Beanstalk will begin building an individual background for you to expand your application to. It will build an Amazon EC2 instance, a security group, an Auto Scaling group, an Amazon S3 container, Amazon CloudWatch alarms, and a domain name for your app.
How to Get a copy of the sample code?
In this step, you will recover a copy of the sample app’s code and determine a reference to host the code. The pipeline does code from the source and then performs actions on it. You can use one of three choices as your source: a GitHub repository, an Amazon S3 bucket, or an AWS CodeCommit repository.
How to Create your pipeline?
In this step, you will build and configure an easy pipeline with two things: source and expand. You will present CodePipeline with the situations of your source repository and deployment environment.
- On the entry page, match Create pipeline.
- If this is your initial time using AWS CodePipeline, an introductory page shows instead of Welcome. Select Get Started.
Go through the below steps:
- On Step 1: Name page: Pipeline name: register the name for your pipeline, DemoPipeline. Select Next step.
- On Step 2: Source page, choose the location of the source you decided and understand the steps below:
Source Provider: GitHub
In the Connect to GitHub part, succeed Connect to GitHub.
A fresh browser window will start to compare you to GitHub. If inspired to sign in, produce your GitHub credentials.
You will be requested to approve application entrance to your account. Choose Approve application.
Designate the repository and branch:
Repository: In the drop-down list, choose the GitHub repository you want to use as the source situation for your pipeline. Match the angled repository in your GitHub account including the sample code called aws-codepipeline-s3-aws-codedeploy_linux.
Branch: In the drop-down list, like the branch, you need to use, master.
Click Next level.
A true constant deployment pipeline needs a build stage, where code is organized and unit tested. CodePipeline lets you secure your favoured build provider into your pipeline. However, in this blog, you will jump to the build stage.
In Step 3: Build page, want No Build.
Click Next step.
In Step 4: Beta page:
Deployment provider: Select AWS Elastic Beanstalk.
Application name: select My First Elastic Beanstalk Application.
Environment name: Select Default-Environment.
Select Next step.
In Step 5: Service Role page:
Service Role: Select Generate role.
You will be redirected to an IAM console page that explains the AWS-CodePipeline-Service role that will be generated for you. Press Allow
After you perform the role, you are declared to the Step 5: Service Role page where AWS-CodePipeline-Service issues in the Role name. Click Next step.
How to Activate your pipeline to deploy your code?
In this step, you will start your pipeline. Once your pipeline has been built, it will begin to work automatically. First, it recognizes the sample app code in your source area, packages up the files, and then moves them to the second step that you established. During this step, it gives the code to Elastic Beanstalk, which includes the EC2 instance that will receive your code. Elastic Beanstalk holds deploying the code to the EC2 instance.
- In Step 6: Summary page, examine the data and select Create pipeline.
- After your pipeline is built, the pipeline status page looks and the pipeline automatically starts to work. You can see the process, as well as success and failure messages as the pipeline, make each action. To make sure your pipeline ran successfully, monitor the progress of the pipeline as it moves through each stage. The change of each stage will change from No executions yet to In Progress, and then to either Succeeded or Failed. The pipeline should build the initial run within a few minutes.
- In the status section for the Beta stage, select AWS Elastic Beanstalk.
- The AWS Elastic Beanstalk console starts with the parts of the deployment. Click the background you built earlier, called Default-Environment.
- Click the URL that looks in the upper-right section of the page to observe the sample website you extended.
How to Commit a change and then update your app?
In this step, you will change the sample code and perform the transition to your repository. CodePipeline will identify your looped sample code and then automatically start deploying it to your EC2 instance via Elastic Beanstalk. Note that the example web page you deployed refers to AWS CodeDeploy, a set that automates code deployments. In CodePipeline, CodeDeploy is an option to use Elastic Beanstalk for deployment activities. Let’s renew the example code so that it accurately states that you extended the sample using Elastic Beanstalk.
Encourage your own copy of the repository that you forked in GitHub.
- Open index.html
- Choose the Edit icon.
- Refresh the webpage
- Perform the addition to your repository.
- Go back to your pipeline in the CodePipeline console. In a few minutes, you should see the Reference change to blue, symbolizing that the pipeline has identified the modifications you made to your source repository. Once this happens, it will automatically move the renewed code to Elastic Beanstalk.
- After the pipeline status designates Succeeded, in the state area for the Beta stage, select AWS Elastic Beanstalk.
- The AWS Elastic Beanstalk console starts with the features of the deployment. Select the environment you built earlier, called Default-Environment.
- Click the URL that seems in the upper-right part of the page to see the sample website again. Your manual has been renewed automatically through the constant deployment pipeline!
How to Clean up your resources?
To bypass future charges, you will remove all the materials you launched throughout this blog, which covers the pipeline, the Elastic Beanstalk application, and the source you set up to host the code.
First, you will remove your pipeline:
- In the pipeline scene, select Edit.
- Select Delete.
- Type in the name of the pipeline and select Delete.
Second, remove your Elastic Beanstalk application:
Read the Elastic Beanstalk console.
Then click Terminate Environment.
If you built an S3 bucket for this blog, remove the bucket you built:
Enter the S3 console.
Right-click the bucket including and select Delete Bucket.
When a verification message arrives, type the bucket name and then select Delete.
You have favorably produced an automated software release pipeline using AWS CodePipeline, Using CodePipeline, you built a pipeline that uses GitHub, Amazon S3, or AWS CodeCommit as the source location for use code and then expands the code to an Amazon EC2 instance run by AWS Elastic Beanstalk. Your pipeline will automatically extend your code every time there is a code transformation. You are one step closer to practicing constant deployment!
If you have any questions about the above topic or have to get services and consultations and get the best AWS services. Feel free to contact us. AIRO ZERO CLOUD will be your strong digital partner. E-mail id: [email protected]