Remove On-Premises Instance from AWS CodeDeploy Deployment Group | Best Method

Removing On-Premises Instance from AWS CodeDeploy Deployment Group

Prev Question Next Question

Question

Your team uses AWS CodeDeploy to automate the deployments to several AWS EC2 instances and on-premises instances.

A deployment group is used to define which individual instances are included.

For some testing activities, you need to remove one on-premises instance from the deployment group for two weeks.

During the time, AWS CodeDeploy should not deploy any new revisions to this particular instance.

Which of the following methods is the most appropriate?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - D.

Option A is incorrect because it is inappropriate to uninstall the CodeDeploy agent or remove the configuration file from the on-premises instance since you only need to suspend the deployments for two weeks.

The correct way is to remove the tag from the instance.

Option B is incorrect because it is unnecessary to deregister the instance from CodeDeploy.

Normally, you deregister an on-premises instance when you are no longer planning to deploy to it.

Option C is incorrect because only one on-premises instance should be removed.

With the new deployment group, all the on-premises instances will be excluded.

Option D is CORRECT because by removing the tag from the instance, any further deployments will not impact the on-premises instance as a deployment group relies on tags to determine which instances are included.

Reference:

https://docs.aws.amazon.com/codedeploy/latest/userguide/on-premises-instances-operations-remove-tags.html, https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-groups-create-in-place.html.

The most appropriate method for removing an on-premises instance from a CodeDeploy deployment group for two weeks without deploying any new revisions to this instance is option D: Check the tag used by the deployment group and use the AWS CLI "aws deploy remove-tags-from-on-premises-instances" to remove the tag from the particular on-premises instance.

Here's why:

Option A: Use the AWS CLI command aws deploy uninstall to uninstall the CodeDeploy agent and remove the configuration file from the on-premises instance.

This option is not appropriate because it uninstalls the CodeDeploy agent from the on-premises instance, which would prevent the instance from being able to receive any deployments at all. This option would work if you wanted to permanently remove the instance from the deployment group, but not for a temporary removal.

Option B: Use the AWS CLI command aws deploy deregister to deregister the on-premises instance from the AWS CodeDeploy service.

This option is not appropriate because it would completely deregister the on-premises instance from the CodeDeploy service, which would require re-registration to add it back into the deployment group. This option would work if you wanted to permanently remove the instance from the deployment group, but not for a temporary removal.

Option C: Create another deployment group with a new tag that is not used by all the on-premises instances. Modify the CodeDeploy application to use this new deployment group.

This option is not the most appropriate because it requires the creation of a new deployment group and tag, which may not be necessary for a temporary removal of a single instance. It also requires modifying the CodeDeploy application, which can be time-consuming and potentially risky.

Option D: Check the tag used by the deployment group and use the AWS CLI aws deploy remove-tags-from-on-premises-instances to remove the tag from the particular on-premises instance.

This is the most appropriate method for temporarily removing a single on-premises instance from a CodeDeploy deployment group without deploying any new revisions to that instance. This option does not require the creation of a new deployment group or modifying the CodeDeploy application. Instead, it simply removes the tag used by the deployment group from the particular on-premises instance that needs to be temporarily removed. This can be done easily using the AWS CLI aws deploy remove-tags-from-on-premises-instances command. Once the two-week period is over, the tag can be re-added to the instance to add it back into the deployment group.