Concepts and terminologies

CodeDeploy essentially comprises two main configurable sections that can be broadly classified as deployments and applications. Here's a look at each of these concepts:

  • Applications: Applications here imply simple names that are used by CodeDeploy to identify individual application codes targeted for specific deployments. An application can be deployed either on an EC2 instance, an on-premise instance, as well as on a serverless compute platform, such as AWS Lambda.
  • Deployments: Deployments are a collection of deployment configurations and deployment types, including:
    • Deployment configurations: Deployment configurations are a set of simple rules that determine how fast an application will be deployed and the success or failure conditions for that particular deployment. For example, for an EC2 deployment, the configuration rules can dictate the required minimum number of healthy instances, whereas with a Lambda function deployment, these rules can be used to specify how the traffic is routed to the functions during a deployment.
    • Deployment group: This is a group of EC2 or on-premise instances that are either standalone or a part of an auto-scaling group. Since AWS Lambda is a managed service, it does not provide any deployment groups.
    • Deployment types: Deployment types indicate the type of method used to get the latest version of your application deployed on a particular deployment group. There are two deployment types supported:
      • In-place deployments: In this case, the application running on each EC2 instance is stopped, updated, started, and verified. This form of deployment is only supported for EC2 and on-premise instances.
      • Blue/green deployments: In this scenario, the underlying instances are replaced by newer instances with the updated piece of code. The instances are registered to an Elastic Load Balancer (ELB) that routes traffic to the newer instances while the older instances can then be terminated. With the serverless platform, the traffic here too is shifted automatically by AWS from the current Lambda functions to the current updated ones. Note that all Lambda deployments are in fact blue/green deployments only.
  • CodeDeploy agent: CodeDeploy agent is a simple software package that gets installed on either an EC2 or an on-premise instance and is used by CodeDeploy for setting up and working with application deployments. Once the agent is installed on an instance, an associated configuration file is created. This file contains application-specific directory paths and other settings that CodeDeploy uses to interact with the instances. The file is a simple YAML file and can be located in the following directories based on the instance's operating system:
    • Amazon Linux, Ubuntu, RedHat Enterprise Linux: /etc/codedeploy-agent/conf/codedeployagent.yml
    • Windows Servers: C:ProgramDataAmazonCodeDeployconf.yml
  • Application specification files: Application specification files, or AppSpec files, are used to define and manage individual deployments as a series of life cycle event hooks. Each hook itself can be another file, such as a simple script to start or stop services, install dependencies, and so on. AppSpec files are supported in both JSON as well as YAML formats. At the time of the deployment, the AWS CodeDeploy agent looks up the name of the current event in the hooks section of the AppSpec file. If an event is found, the agent retrieves the list of scripts to execute and runs them sequentially in the order in which they were written in the AppSpec file.

With the basics out of the way, let's quickly look at how we can set up an EC2 instance to be used with CodeDeploy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset