The deployment to Lightsail instances failed because no instances were found for your deployment group

1.8k views Asked by At

Following from Marci's answer, I went on and tried to deploy from GitHub using the steps he mentions (adapting the region) but I'm getting

The deployment failed because no instances were found for your deployment group. Check your deployment group settings to make sure the tags for your Amazon EC2 instances or Auto Scaling groups correctly identify the instances you want to deploy to, and then try again.

The deployment failed

According to Gabriel in 2017

Lightsail is intended for smaller projects and doesn't support load balancing or auto-scaling groups at this time.

The only thing I could think of doing atm was to make sure each instance is using the tag myasg which is the same tag used in the Deployment Group

Tagged instances

Deployment Group tags

but that isn't enough.

1

There are 1 answers

0
Marcin On BEST ANSWER

Based on the comments:

Lightsale (LS) instances are considered as on-premise instances. This means that in order to use CodeDeploy (CD) with them, they need to be registered with CD as on-premises instances.

In order to do this, one can follow three steps:

  1. Make sure that CD agent is installed and running on the LS instance. The answer has details on the installation procedure.

codedeploy-agent is running

  1. In AWS CLI, register LS instance with CD (Note that Amazon_Linux_2 is the name of the instance)
aws deploy register-on-premises-instance --instance-name Amazon_Linux_2 --iam-user-arn arn:aws:iam::525221857828:user/Linux2CodeDeployUser --region eu-west-2
  1. Add tags to the instance registered:
aws deploy add-tags-to-on-premises-instances --instance-names Amazon_Linux_2 --tags Key=myasg --region eu-west-2, (2.3) aws deploy list-on-premises-instances --region eu-west-2

instance is registered as on-premise instance

This means that now on the first OP's screenshot, there is "On-premises instances" menu option with the following

Instance can be seen in on-premises menu

Retry deployment if previous attempt failed before registration.

Deployment worked fine

and if you check your instances Public IP

Instance public IP

and navigate to it in the browser, you should see the result as expected

Deployment using Amazon Linux 2 Lightsail instance