Content Introduction Prerequisites Virtual Host Redirect to HTTPS Conclusion Introduction To secure the data transfer redirecting the HTTP traffic to...
Read MoreAWS CodePipeline is a fully managed continuous delivery solution provided by Aws. It aids in the automation of release pipelines, allowing for faster application and infrastructure updates. The different stages of a software release process can be customized. The AWS CodePipeline automates the build, test, and deploy phases of the release every time the code is updated.
Log in to the AWS console with a root account or with an IAM user who has permission to access all the services required in Code Pipeline. Navigate to the AWS Code Commit from the Services.
Navigate to the AWS Code Pipeline from the Services or click on the pipelines from the left Navigation pane in the Code Commit window and click on the Create Pipeline button.
A new create pipeline window will appear.
A Source Stage window will appear.
We need to select the option from where we get the code for the application. We will select AWS Code Commit.
The detail window will open to add the information regarding the Code Commit repository.
The Code Build Stage window will open.
A new pop-up window will appear to create a build for the project. Add the project detail as per the requirement.
After selecting Ubuntu as an Operating system detail view is open to adding additional detail.
In the Buildspec section, we need to add the commands for which language we are creating the build and where we want to deploy it. Also, additional commands are used if required in pre-build and post-build. Here, I am using the build command for the angular application.
version: 0.2
env:
variables:
S3_BUCKET: "zehncloud.com"
phases:
install:
runtime-versions:
nodejs: 10
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install
- npm install -g @angular/cli
build:
commands:
- echo Build started on `date`
- ng build --prod --base-href=./
post_build:
commands:
- aws s3 cp dist s3://${S3_BUCKET} --recursive
- echo Build completed on `date`
artifacts:
files:
- '**/*'
base-directory: 'dist*'
discard-paths: yes
After adding all the details in the build project leave other options the same as default and click on Continue to CodePipeline button from the bottom.
The window will automatically close and save the project.
After closing the project window the successful message will appear for creating the project in the build stage window.
A new add deploy stage window will appear. We need to select a deploy provider where the code will be deployed after the build.
A review window will open to confirm all the added details are correct or not.
You can scroll down to review the complete code pipeline details.
The Pipeline is successful and Deploy the code into the S3 bucket.
Note: Sometimes the service role created by the build stage not give permission to access the s3 bucket and due to that the build stage will fail and not get completed. If you face the same issue go to the I am role and review the policy created by the build stage and allow permission to access the S3 bucket and retry to complete the code pipeline.
In this article, we have created AWS CodePipeline for the Angular application. Where if any changes are occurred in the code commit repository the codePipeline automatically starts and creates a build for the latest code and push to the S3 bucket.
Content Introduction Prerequisites Virtual Host Redirect to HTTPS Conclusion Introduction To secure the data transfer redirecting the HTTP traffic to...
Read MoreContent Introduction Requirement Getting Started Conclusion Introduction Angular is an open-source web application framework. It is a TypeScript-based free and development...
Read More