AWS CodeDeploy 在私有 VPC 中不工作
AWS CodeDeploy not working in private VPC
我在 VPC 内有私有子网,路由 table 如下:
XX.X.0.X/16 local
0.0.0.0/0 nat-0XXXXXXXXX
使用上述配置 AWS CodeDeploy 失败并出现错误 Error code: HEALTH_CONSTRAINTS
,/opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log
中没有日志条目。
但是当我通过添加 Internet 网关将其更改为允许 public 访问时
通过以下路由 table AWS CodeDeploy 成功完成。
XX.X.0.X/16 local
0.0.0.0/0 igw-0XXXXXXXXX
我是否缺少任何其他配置?
CodeDeploy 代理需要出站访问互联网才能访问 4 个不同的服务端点。需要访问所有这些端点才能使服务正常工作。
需要出站访问互联网才能访问 (1) 和 CodeDeploy service endpoints,以及 (2)访问 S3 或 Github 服务 - 代理需要此访问权限才能为正在部署的修订下载软件部署包。
...AWS CodeDeploy agent installed on the Amazon EC2 instances must be
able to access the public AWS CodeDeploy and Amazon S3 service
endpoints. For more information, see AWS CodeDeploy Endpoints and
Amazon S3 Endpoints.
(3) CodeDeploy 代理会定期 check for software updates, and automatically update itself within 24 hours of a new release. A properly configured CodeDeploy agent instance will allow IAM S3 access to the AWS CodeDeploy Resource Kit Reference 存储桶,以便它可以在可用时访问新软件。未能在此处提供更新访问权限可能会在服务升级时中断您的实施,或限制对新功能的访问。
(4) 关于 CodeDeploy 命令和控制,代理的源代码显示了对特殊命令 https
端点的引用,称为 AWS_DEPLOY_CONTROL_ENDPOINT
:
来自 aws-codedeploy-agent 软件 repository,deploy_control_endpoint.rb
文件具有以下内容:
require 'aws-sdk-core'
module Aws
module Plugins
class DeployControlEndpoint < Seahorse::Client::Plugin
option(:endpoint) do |cfg|
url = ENV['AWS_DEPLOY_CONTROL_ENDPOINT']
if url.nil?
url = "https://codedeploy-commands.#{cfg.region}.amazonaws.com"
if "cn" == cfg.region.split("-")[0]
url.concat(".cn")
end
end
url
end
end
end
end
虽然显然没有记录,但也需要访问此端点。
我在 VPC 内有私有子网,路由 table 如下:
XX.X.0.X/16 local
0.0.0.0/0 nat-0XXXXXXXXX
使用上述配置 AWS CodeDeploy 失败并出现错误 Error code: HEALTH_CONSTRAINTS
,/opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log
中没有日志条目。
但是当我通过添加 Internet 网关将其更改为允许 public 访问时 通过以下路由 table AWS CodeDeploy 成功完成。
XX.X.0.X/16 local
0.0.0.0/0 igw-0XXXXXXXXX
我是否缺少任何其他配置?
CodeDeploy 代理需要出站访问互联网才能访问 4 个不同的服务端点。需要访问所有这些端点才能使服务正常工作。
需要出站访问互联网才能访问 (1) 和 CodeDeploy service endpoints,以及 (2)访问 S3 或 Github 服务 - 代理需要此访问权限才能为正在部署的修订下载软件部署包。
...AWS CodeDeploy agent installed on the Amazon EC2 instances must be able to access the public AWS CodeDeploy and Amazon S3 service endpoints. For more information, see AWS CodeDeploy Endpoints and Amazon S3 Endpoints.
(3) CodeDeploy 代理会定期 check for software updates, and automatically update itself within 24 hours of a new release. A properly configured CodeDeploy agent instance will allow IAM S3 access to the AWS CodeDeploy Resource Kit Reference 存储桶,以便它可以在可用时访问新软件。未能在此处提供更新访问权限可能会在服务升级时中断您的实施,或限制对新功能的访问。
(4) 关于 CodeDeploy 命令和控制,代理的源代码显示了对特殊命令 https
端点的引用,称为 AWS_DEPLOY_CONTROL_ENDPOINT
:
来自 aws-codedeploy-agent 软件 repository,deploy_control_endpoint.rb
文件具有以下内容:
require 'aws-sdk-core'
module Aws
module Plugins
class DeployControlEndpoint < Seahorse::Client::Plugin
option(:endpoint) do |cfg|
url = ENV['AWS_DEPLOY_CONTROL_ENDPOINT']
if url.nil?
url = "https://codedeploy-commands.#{cfg.region}.amazonaws.com"
if "cn" == cfg.region.split("-")[0]
url.concat(".cn")
end
end
url
end
end
end
end
虽然显然没有记录,但也需要访问此端点。