Way to speed up AWS CodeDeploy

amazon-web-servicesdeployment

I'm using AWS CodeDeploy to deploy my sites, and I noticed it's not very consistent in speed; sometimes it's pretty fast, but other times each step of a deployment can take minutes. This is pretty annoying when a deployment should be performed fast, in case of bugs or outages.

I can't find any documentation on the speed of CodeDeploy though, and also I can't seem to find any logic in when it's slow or when it's fast. Is there any way to speed it up and is there any way to know what's taking so long?

Best Answer

CodeDeploy does very little by default - it grabs the code from S3 or Github, then runs your scripts per the appspec.yml file's instructions.

If your deployments are grabbing gigabytes of data from S3, you'll find that takes some time for the data transfer (particularly on smaller EC2 instances with limited bandwidth), but other than that deployment delays are much more likely to be due to whatever you're doing in your deployment scripts.

The steps in a CodeDeploy deployment are:

  • ApplicationStop - you control this hook
  • DownloadBundle - CodeDeploy grabs code from S3/Github
  • BeforeInstall - you control this hook
  • Install - CodeDeploy copies code from a temp location to the final destination
  • AfterInstall - you control this hook
  • ApplicationStart - you control this hook
  • ValidateService - you control this hook

The bolded ones are up to CodeDeploy, the others are up to you. If you're seeing varying delays in the bolded ones, contact AWS support, but otherwise chances are you need to investigate your hooks.