jkinkead
jkinkead

Reputation: 4421

Restarting applications using Amazon CodeDeploy

We occasionally have the need to restart services that are deployed with AWS CodeDeploy. Is it possible to have the CodeDeploy agent do this directly, without having to create a new deployment?

Upvotes: 3

Views: 2600

Answers (3)

Binh
Binh

Reputation: 21

To expand on eternaltyro's answer, you could leverage CodeDeploy's CLI tool via SSM to run the same CodeDeploy event hooks that were/are used to start and stop your application.

Upvotes: 1

eternaltyro
eternaltyro

Reputation: 336

The AWS service you're looking for is AWS Systems Manager. You can run arbitrary commands or scripts on instances with this2. All recent Ubuntu and Amazon Linux instances have AWS SSM agent installed. But if you have an older instance, you'll have to install the SSM agent manually or through your configuration manager.

Upvotes: 2

broun
broun

Reputation: 2593

No, you need to have a deployment to restart. The agent does not take actions on its own. It receives commands from the CodeDeploy service.

Depending on your usecase you can have your application emit CloudWatch event and have that trigger a deployment in the deploymentGroup. Note that it will create a deployment that will deploy to the entire fleet.

Upvotes: 1

Related Questions