Build Applications Locally Using AWS CodeBuild

Build Applications Locally Using AWS CodeBuild


Build Applications Locally Using AWS CodeBuild

In this video, you’ll see how to build applications locally using AWS CodeBuild. With the CodeBuild local agent, you can test the integrity and contents of buildspec files locally, build and test applications locally before committing, and identify and fix errors quickly from your local development environment. AWS CodeBuild is a fully managed service, with no servers to provision and scale, and no software to install, configure, and operate. You just specify the location of your source code, choose your build settings, and CodeBuild runs build scripts for compiling, testing, and packaging your code. CodeBuild now offers local build support.

Learn more about AWS CodeBuild at - https://amzn.to/3n0IStK

Subscribe:
More AWS videos http://bit.ly/2O3zS75
More AWS events videos http://bit.ly/316g9t4

#AWS #AWSDemo


Content

0.44 -> In this video, you’ll see how to build applications locally using AWS CodeBuild.
5.16 -> With the CodeBuild local agent, you can test the integrity and contents of buildspec files locally,
10.26 -> build and test applications locally before committing,
13.06 -> and identify and fix errors quickly from your local development environment.
17.5 -> AWS CodeBuild is a fully managed service, with no servers to provision and scale,
22.06 -> and no software to install, configure, and operate.
25.24 -> You just specify the location of your source code, choose your build settings,
28.96 -> and CodeBuild runs build scripts for compiling, testing, and packaging your code.
33.74 -> CodeBuild now offers local build support.
36.02 -> Let’s see how to set that up.
38.26 -> For the purposes of this example, we’ll use the Cloud9 integrated development environment (IDE),
43.54 -> but you can use any local development environment.
46.6 -> By default, Cloud9 instances already have Docker and Git installed.
51.32 -> Note that the development environment you plan to use must also have Docker and Git installed
55.26 -> before you can set up CodeBuild locally.
58.14 -> Let’s begin by cloning the AWS Git repository that contains Docker images
62.3 -> for the available CodeBuild versions.
65.38 -> Now that we’ve cloned the necessary repository, let’s take a look at its contents.
71.98 -> This repository contains several different CodeBuild images and the files needed to build and use them.
77.66 -> For the purposes of this example, we’ll use the CodeBuild 3.0 Docker image.
82.38 -> Here’s the Dockerfile for CodeBuild 3.0 and its necessary files.
87.1 -> Let's return to the console and navigate to this file directory so we can build the image.
95 -> Now we’ll use the Docker “build” command to build AWS CodeBuild 3.0 locally.
100.7 -> Building the Docker image from this Dockerfile can take around 30 minutes to successfully execute.
105.76 -> Ensure that your local environment has at least 10 GB of free space to complete the build.
111.88 -> The Docker image was successfully built and tagged.
114.66 -> Next, let’s clear the screen and use the “docker pull” command to download the CodeBuild local image.
120.58 -> The CodeBuild local image runs the CodeBuild local agent,
123.74 -> which acts as a local version of the remote CodeBuild build servers.
127.44 -> This allows you to use CodeBuild to locally build and package an application from within a Docker container.
133.1 -> Now that the Docker image for the CodeBuild local agent has been pulled,
136.24 -> let’s return to the home environment to build a sample web application.
140.24 -> First, we’ll download a CodeBuild script you can use to run your local builds.
144.58 -> Next, we’ll make the shell script we just downloaded executable.
148.32 -> For our purposes, let’s clone a sample Java web application to build with CodeBuild locally.
153.94 -> Now that the sample Java web application has been cloned to the home environment,
157.4 -> let’s try running the script on the application as-is.
161.22 -> First, we’ll specify the shell script that we’re running.
164.76 -> Next, we need to specify the tag of the CodeBuild Docker image we built.
169.4 -> Next, we’ll specify the desired output artifact directory.
173.68 -> Finally, we’ll specify the directory containing the source code.
177.56 -> As you can see, we got a runtime error that says a needed YAML file does not exist.
182.82 -> To successfully build a project with CodeBuild,
185.16 -> you must create a buildspec.yml file at the root of the source directory.
189.32 -> This file provides instructions to CodeBuild on build configurations and options.
193.4 -> Let’s create the file now.
198.32 -> Now that we’ve created a build specifications file, let’s return to the home environment.
206.8 -> Let’s run the CodeBuild script again.
210.52 -> As you can see, the CodeBuild agent successfully built the sample web application in a local
214.66 -> environment from within a Docker container.
217.34 -> Let’s take a look in the artifacts directory.
221.46 -> Here we can see the output artifact of the CodeBuild build.
224.96 -> To ensure you’re aware of any new CodeBuild agent versions,
227.96 -> you can create an Amazon Simple Notification Service (Amazon SNS) subscription.
232.52 -> Let’s do that now.
236.58 -> We’ll paste in a specific Topic ARN that sends out notifications
240.12 -> whenever a new CodeBuild version is available.
243.1 -> Now we can proceed through the steps and create the subscription.
255.66 -> Once the subscription is confirmed, we’ll receive email notifications whenever a new
259.38 -> version of CodeBuild becomes available.
262.68 -> You’ve just seen how to build applications locally using AWS CodeBuild.
267.26 -> Thanks for watching.
268.2 -> Now it's your turn to try.

Source: https://www.youtube.com/watch?v=N3pW4ZCeCxA