5 Reasons Why You Should Use CodeDeploy

CodeDeploy is a deployment service from AWS which enables you to deploy code changes quickly and without any manual intervention. This saves you time and prevents errors that could be induced by manual activity.

Using CodeDeploy, you can deploy a variety of artifacts and not just only code. For example, you can deploy an executable, a package, multimedia files, etc.

Also, you can deploy your artifacts not only to EC2, but also to lambda functions, on-prem instances, and ECS.

Well, practically anywhere. All that you need to do is install the agent and you are halfway done.

So you can deploy a lot of different artifacts to a lot of different targets, but what about the source? Do you have the same flexibility in deciding the source of your artifacts?

Yes.

You can have the artifacts in an S3 bucket, in a GitHub repository, or in a BitBucket repository. And you can also configure it to accept a CodeBuild artifact as its source

That way you get a lot of flexibility in your CICD when working with CodeDeploy

Benefits Of CodeDeploy


Here are 5 major reasons why you should use CodeDeploy to deploy your application

Can deploy a variety of applications

There used to be a time when the application code was deployed on servers. Although we cannot completely remove servers (they’ll always be there), with time we have added a lot of abstractions on top of that.

For example, we have function-as-a-service where you are charged only for the time your function is executed, like AWS lambda functions.

Using CodeDeploy, you can not only deploy your code to EC2 instances but can also deploy lambda functions.

And by installing the CodeDeploy agent and configuring proper access, you can deploy your code pretty much anywhere

Automated Deployments

Gone are the days when developers used to throw their code over the metaphorical wall to operations and the operations team then deployed it.

There were a lot of problems with this approach, the major ones being

  1. It is manual and hence error-prone
  2. It takes too much time and reduces developer velocity

To combat these, automation was brought into the picture and then evolved the entire CICD part of the process.

Automation in the deployment process is essential – because it not only speeds things up but also reduces the possibility of errors during deployments

Also, manually putting code to machines cannot scale linearly with the application size.

CodeDeploy takes care of these by providing you with a way to automatically deploy your code to your servers.

You just need to configure it once and then it will be completely automated till the time you do not want to change your deployment scripts

Reduce downtime

If you have ever had an application running in production, you’ll be aware of the dreaded downtime!

What could hamper a developer’s enthusiasm more than knowing that he’ll be causing downtime every time he launches a new feature or fixes a bug.

This will cause him to be very cautious of deploying code and therefore reduce the productivity and speed of development.

This is basically everything opposite to what we want.

CodeDeploy takes care of this for you. It deploys code such that you always have a minimum number of healthy servers ready to serve your users.

There are basically two methods to deploy your code – in-place deployment and blue-green deployment.

In both of these, you can configure the minimum number of instances to keep up and running while others are being updated with the latest code.

Rollback

You deployed a code and the deployment failed – now you’re screwed!

Why?

Because not only did a working code is present on the server, but also the existing code might not function properly thanks to the failed deployment.

In such a scenario, we have an option for rollback.

What this does is that if the latest deployment fails, CodeDeploy will deploy the last successful deployment back – to ensure that it did not break anything

Concurrent Deployments

Many times we have a lot of different applications hosted on the same server. For example, three different web applications behind an nginx proxy.

Now, what if you pushed a code for two of those at the same time?

CodeDeploy will very efficiently deploy both of those to the server.

But there is a word of caution here though.

If your applications are interdependent, for example, a CLI and a framework based on the CLI – you might face some issues.

Let me explain better.

So consider that we have a command cli start framework to start the framework. Now since CLI is being deployed, it won’t work properly.

And we are also deploying our framework, so we call the command cli start framework. Guess what?

It will not execute properly and give us an error!

In this case, you would like to put these as two stages in a single code pipeline to ensure that they are deployed sequentially and not parallelly.