官术网_书友最值得收藏!

  • AWS Automation Cookbook
  • Nikit Swaraj
  • 426字
  • 2021-07-02 23:00:44

How to do it...

  1. Go to the AWS Console and click on the AWS CodeBuild Service. After that, click on Create project.
  2. We will get a page where we have to fill all the details that I have mentioned in the Getting ready section in this recipe. The page will look like as follows:
  1. We will mention the Project name as CB-NodeJS-BS in the Configure your project section:
  1. In the Source section, choose AWS CodeCommit as Source provider. Select the repository name where you migrated the book application. In my case, the AWS CodeCommit repository name where the book application code resides is CB-NODEJS-Site:
  1. In the Environment section, Environment image will be Image managed by AWS CodeBuild. The OS will be Ubuntu, Runtime will be Node.js, Version will be aws/codebuild/nodejs:4.3.2, Build specification will be Use the buildspec.yml in the source code root directory:
  1. Now in the Artifact section, we use AWS S3 to store the build output. So, Artifact type will be Amazon S3. The Artifacts name will be Nodejs-bs; Bucket name is where you put the artifact. In my case, its awsstar-s3:
  1. Now choose any existing service role, which will allow AWS CodeBuild to access any other AWS resources:
  1. In advance, we can tweak the compute settings and pass the environment variables; but at this moment, it is not required.
  2. Finally, we click on Continue and review the configuration:
  1. Once you are done reviewing, then click on Save and Build. We will be asked which branch we want to build. In the advanced options, we will be asked regarding the Artifact Package, which we will put as zip. Then, click on start build:
  1. We will see that the build process has been started and succeeded in a minute:
  1. We will see different phases of the build as well:
  1. In the Build details section, we can see the output artifact; when we click on Build artifacts, we will be redirected to the S3 bucket where our artifact will reside after the successful build:
  1. The following screenshot shows the artifact in the S3 bucket:
  1. Now, download the zip file and unzip it to your production machine and place it on the proper path where webserver can read it. After that, restart the webserver and try to access the page:

In both the preceding examples, we saw how we can work with AWS CodeBuild either using build commands in the console or using the buildspec.yml file.

主站蜘蛛池模板: 济源市| 方山县| 张掖市| 新民市| 吉木萨尔县| 天水市| 大渡口区| 垦利县| 外汇| 江西省| 广东省| 凉城县| 临邑县| 确山县| 筠连县| 佛冈县| 偏关县| 容城县| 汕头市| 札达县| 庆阳市| 凤山县| 萍乡市| 泊头市| 淮南市| 清徐县| 平度市| 宁夏| 长岭县| 阿合奇县| 加查县| 北川| 应城市| 温州市| 南郑县| 汝阳县| 潮州市| 湖南省| 汪清县| 巴林右旗| 龙江县|