amazon-web-services - 部署到 Lightsail 实例失败,因为找不到适合您的部署组的实例

标签 amazon-web-services aws-code-deploy amazon-lightsail amazon-linux-2

Marci's answer之后,我继续尝试使用他提到的步骤(调整区域)从 GitHub 进行部署,但我得到了

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

根据Gabriel in 2017

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

我能想到做 atm 的唯一一件事是确保每个实例都使用标签 myasg ,该标签与部署组中使用的标签相同

Tagged instances

Deployment Group tags

但这还不够。

最佳答案

根据评论:

Lightsale (LS) 实例被视为本地实例。这意味着,为了将 CodeDeploy (CD) 与它们一起使用,它们需要使用 CD 注册作为本地实例。

为了做到这一点,可以遵循三个步骤:

  1. 确保 CD 代理已安装并在 LS 实例上运行。 answer有安装过程的详细信息。

codedeploy-agent is running

  • 在 AWS CLI 中,使用 CD 注册 LS 实例(请注意,Amazon_Linux_2 是实例的名称)
  • aws deploy register-on-premises-instance --instance-name Amazon_Linux_2 --iam-user-arn arn:aws:iam::525221857828:user/Linux2CodeDeployUser --region eu-west-2
    
  • 向注册的实例添加标签:
  • 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

    这意味着现在在第一个 OP 的屏幕截图上,有“本地实例”菜单选项,其中包含以下内容

    Instance can be seen in on-premises menu

    如果注册前之前的尝试失败,请重试部署。

    Deployment worked fine

    如果您检查您的实例公共(public) IP

    Instance public IP

    并在浏览器中导航到它,您应该会看到预期的结果

    Deployment using Amazon Linux 2 Lightsail instance

    关于amazon-web-services - 部署到 Lightsail 实例失败,因为找不到适合您的部署组的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64176881/

    相关文章:

    amazon-web-services - 即使成功,如何获取 CodeDeploy 事件日志?

    java - 我需要 Java 才能在 Amazon EC2 中运行 hadoop 吗?

    amazon-web-services - 如何过滤NULL?

    amazon-web-services - IAM 策略仅允许 EC2 实例 API 访问以修改自身

    Python AWS Boto URL 连接错误

    amazon-web-services - Terraform 中 S3 存储桶的 AWS Cloudtrail 事件

    .net - 如何在 CodeDeploy 完成部署后保持应用程序运行

    java - Tomcat 在不同机器上部署时找不到 servlet 和 JSP 文件

    mysql - AWS lightsail ubuntu 18.04 服务器上的 Docker mysql 5.7 不断重启

    amazon-web-services - Lightsail 和 EC2 之间有什么区别?