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

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.

主站蜘蛛池模板: 萝北县| 安塞县| 庆安县| 台湾省| 天长市| 五大连池市| 淮北市| 依兰县| 年辖:市辖区| 昭苏县| 林周县| 疏勒县| 澄迈县| 渭南市| 东阳市| 邵东县| 云梦县| 嘉义市| 西昌市| 牟定县| 禹城市| 钦州市| 海盐县| 梧州市| 西昌市| 色达县| 康平县| 碌曲县| 阿克陶县| 临汾市| 晋宁县| 琼海市| 葫芦岛市| 乌兰浩特市| 阿鲁科尔沁旗| 边坝县| 麟游县| 天峨县| 湖州市| 万载县| 开封市|