{"id":27234,"date":"2023-03-02T00:00:56","date_gmt":"2023-11-17T11:24:32","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/"},"modified":"2025-08-12T01:32:48","modified_gmt":"2025-08-11T17:32:48","slug":"%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/","title":{"rendered":"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a"},"content":{"rendered":"<p>\u8003\u8651\u5230\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u65f6\uff0c\u6211\u60f3\u53ef\u80fd\u6709\u5404\u79cd\u9009\u62e9\u3002\u4ee5\u4e0b\u662f\u603b\u7ed3\u7684\u9009\u9879\u3002<\/p>\n<p>\u603b\u7ed3\u5728AWS\u4e0a\u5b9e\u73b0\u90e8\u7f72\u548c\u81ea\u52a8\u6269\u5c55\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u6700\u521d\uff0c\u6211\u4eec\u8003\u8651\u4e86OpsWorks\uff0c\u4f46\u7531\u4e8e\u5b83\u4e0d\u652f\u6301\u81ea\u52a8\u6269\u5c55\uff0c\u6240\u4ee5\u5c31\u820d\u5f03\u4e86\u5b83\u3002\u53e6\u5916\uff0c\u5982\u679c\u4f7f\u7528Jenkins\u7b49\u5de5\u5177\u53ef\u80fd\u662f\u53ef\u884c\u7684\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u907f\u514d\u5c06Jenkins\u53d8\u6210\u5355\u70b9\u6545\u969c\uff0c\u5e76\u4e14\u4e3a\u4e86\u4e0eAWS\u8fdb\u884c\u534f\u4f5c\u800c\u9700\u8981\u4e00\u4e9b\u7410\u788e\u7684\u914d\u7f6e\uff0c\u8fd9\u8ba9\u6211\u611f\u5230\u6709\u4e9b\u9ebb\u70e6\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u6211\u5c1a\u672a\u5230\u8fbe\u4e1c\u4eac\u533a\u57df\uff0c\u4f46CodeDeploy\u652f\u6301\u81ea\u52a8\u4f38\u7f29\uff0c\u6240\u4ee5\u6211\u5c1d\u8bd5\u4e86\u4e00\u4e9b\u6d4b\u8bd5\uff0c\u5e76\u8fdb\u884c\u4e86\u8bb0\u5f55\u3002<\/p>\n<p>\u8fd9\u6b21\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u5c1d\u8bd5\u4f7f\u7528CodeDeploy\u5728GitHub\u4e0apush\u4ee3\u7801\u65f6\u5c06WordPress\u90e8\u7f72\u5230EC2\u4e0a\u3002<\/p>\n<h1>CodeDeploy\u662f\u4ec0\u4e48\uff1f<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d7\u30ed\u30a4\u3092\u884c\u3046\u305f\u3081\u306e\u30b5\u30fc\u30d3\u30b9\u3002\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306a\u3069\u306b\u5236\u9650\u306f\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30c7\u30d7\u30ed\u30a4\u306b\u7279\u5316\u3057\u305f\u6a5f\u80fd\u306a\u306e\u3067\u74b0\u5883\u69cb\u7bc9\u306a\u3069\u306b\u4f7f\u3046\u3079\u304d\u3067\u306f\u306a\u3044(\u3084\u308d\u3046\u3068\u601d\u3048\u3070\u3067\u304d\u308b\u3051\u3069\u3084\u3089\u306a\u3044\u65b9\u304c\u826f\u3044\u3068\u601d\u3046\uff09\u74b0\u5883\u69cb\u7bc9\u3082\u3057\u305f\u3044\u5834\u5408\u3001ElasticBeanstalk\u3084OpsWorks\u3092\u8003\u3048\u305f\u307b\u3046\u304c\u826f\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>appspec.yml\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30d7\u30ed\u30a4\u6642\u306e\u8a73\u7d30\u3092\u8a18\u8ff0\u3002\u30c7\u30d7\u30ed\u30a4\u6642\u306e\u72ec\u81ea\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u4efb\u610f\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3067\u304d\u308b<br \/>\n\u7279\u5b9a\u306e\u30bf\u30b0\u304c\u4ed8\u4e0e\u3055\u308c\u305fEC2\u7fa4\u3082\u3057\u304f\u306f\u30aa\u30fc\u30c8\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u306b\u7d10\u3065\u304fEC2\u7fa4\u306b\u30c7\u30d7\u30ed\u30a4\u53ef\u80fd<br \/>\n\u7279\u5b9a\u306e\u30ea\u30d3\u30b8\u30e7\u30f3\u306b\u623b\u308b\u3053\u3068\u304c\u53ef\u80fd<br \/>\n\u73fe\u5728\u306fGitHub\u3068S3\u3068\u9023\u643a\u304c\u53ef\u80fd(\u306a\u305cCodeCommit\u304c\u306a\u3044??)<br \/>\n\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306fCodeDeployAgent\u3092\u5bfe\u8c61EC2(\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<br \/>\n\u5bfe\u8c61OS\u306fAmazon Linux\u3001Red Hat Enterprise Linux\u3001Ubuntu Server\u3001Microsoft Windows Server<br \/>\nCodeDeploy\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u63a5\u7d9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30b5\u30d6\u30cd\u30c3\u30c8\u306e\u5834\u5408\u306a\u3069\u306b\u306fNAT\u304c\u5fc5\u8981<\/p>\n<h1>\u5047\u8bbe<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">AWS CLI\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitHub\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u53d6\u5f97\u6e08\u307f<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">2015\/7\/20\u73fe\u5728CodeDeploy\u306ftokyo\u30ea\u30fc\u30b8\u30e7\u30f3\u306f\u306a\u3044\u306e\u3067us-east1\u3067\u78ba\u8a8d<\/ul>\n<h1>\u8bf7\u53c2\u8003<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Using the AWS CodeDeploy Create Deployment Walkthrough<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Automatically Deploy from GitHub Using AWS CodeDeploy<\/ul>\n<h1>\u521b\u5efaCodeDeploy\u4f7f\u7528\u7684\u89d2\u8272\u4e3aAWS CodeDeploy\u521b\u5efa\u4e00\u4e2a\u670d\u52a1\u89d2\u8272<\/p>\n<p>\u6211\u4eec\u5bf9CodeDeploy\u81ea\u8eab\u4f7f\u7528\u7684\u89d2\u8272\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u9996\u5148\uff0c\u521b\u5efa\u4ee5\u4e0b\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Sid\": \"\",\r\n      \"Effect\": \"Allow\",\r\n      \"Principal\": {\r\n        \"Service\": [\r\n          \"codedeploy.us-east-1.amazonaws.com\", \r\n          \"codedeploy.us-west-2.amazonaws.com\",\r\n          \"codedeploy.eu-west-1.amazonaws.com\",\r\n          \"codedeploy.ap-southeast-2.amazonaws.com\"\r\n        ]\r\n      },\r\n      \"Action\": \"sts:AssumeRole\"\r\n    }\r\n  ]\r\n}\r\n<\/code><\/pre>\n<p>\u5b8c\u6210\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u521b\u5efa\u540d\u4e3a CodeDeployDemo \u7684\u7528\u4e8e CodeDeploy \u7684\u89d2\u8272\u3002<\/p>\n<pre class=\"post-pre\"><code>$aws iam create-role --role-name CodeDeployDemo --assume-role-policy-document file:\/\/CodeDeployDemo-Trust.json\r\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u4e4b\u540e\uff0c<\/p>\n<p>&#8220;Arn&#8221;: &#8220;arn:aws:iam::hogefuga:role\/CodeDeployDemo&#8221;<br \/>\n\u963f\u6069: &#8220;arn:aws:iam::hogefuga:role\/CodeDeployDemo&#8221;<\/p>\n<p>\u4ee5\u8fd9\u79cd\u5f62\u5f0f\u663e\u793a\u8be5\u89d2\u8272\u7684Arn\uff0c\u8bb0\u4e0b\u6765\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4ee5\u4fbf\u5c06\u5148\u524d\u7684\u89d2\u8272\u914d\u7f6e\u4e3a\u53ef\u7528\u4e8eCodeDeploy\u3002<\/p>\n<pre class=\"post-pre\"><code>$aws iam attach-role-policy --role-name CodeDeployDemo --policy-arn arn:aws:iam::aws:policy\/service-role\/AWSCodeDeployRole\r\n<\/code><\/pre>\n<h1>\u521b\u5efaRDS\u8bf7\u4f7f\u7528RDS\u5728us-east1\u533a\u57df\u521b\u5efaMySQL\u6570\u636e\u5e93\uff0c\u7528\u4e8eWordPress\u7684\u4f7f\u7528\u3002\u540c\u65f6\uff0c\u8bf7\u8bbe\u7f6e\u4e00\u4e2aSecurityGroup\uff0c\u5141\u8bb8\u4ece\u63a5\u4e0b\u6765\u521b\u5efa\u7684EC2\u5b9e\u4f8b\u901a\u8fc73306\u7aef\u53e3\u8fdb\u884c\u8fde\u63a5\u3002\u8bf7\u8bb0\u4e0b\u5728\u521b\u5efa\u65f6\u8bbe\u7f6e\u7684\u7528\u6237\u540d\u3001\u5bc6\u7801\u4ee5\u53ca\u521b\u5efa\u540e\u7684RDS\u8fde\u63a5\u7ec8\u7aef\u8282\u70b9\u3002<\/p>\n<h1>\u542f\u52a8EC2\u7b2c\u4e00\u6b65: \u542f\u52a8\u4e00\u4e2a\u4e9a\u9a6c\u900a Linux \u6216\u7ea2\u5e3d\u4f01\u4e1a Linux \u7684\u4e9a\u9a6c\u900a EC2 \u5b9e\u4f8b\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">OS\u306fAmazonLinux<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Auto-assign PublicIP\u3092\u6709\u52b9\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">SecurityGroup\u306eInbound\u3067SSH\u3068HTTP\u30920.0.0.0\/0\u3067\u8a31\u53ef\u3057\u3001Outbound\u306f\u5236\u9650\u3057\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">S3\u306eread\u6a29\u9650\u304c\u3042\u308bIAM\u30ed\u30fc\u30eb\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068(CodeDeployAgent\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u305f\u3081\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Name\u30bf\u30b0\u3067\u306fCodeDeployDemo\u3068\u8a2d\u5b9a\u3059\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">UserData\u306b\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3002\u306a\u304a\u3001CodeDeployAgent\u53d6\u5f97\u5148\u30d0\u30b1\u30c3\u30c8\u540d\u306fregion\u306b\u3088\u3063\u3066\u5909\u308f\u308b\u306e\u3067\u6ce8\u610f\u3002\u307e\u305f\u3001SQL\u5b9f\u884c\u306e\u7b87\u6240\u306f\u30e6\u30fc\u30b6\u30fc\u540d\u306froot\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306fpassword\u3001RDS\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306fcodedeploy.cukvcqdui8ox.us-east-1.rds.amazonaws.com \u3068\u3044\u3046\u5834\u5408\u306e\u8a2d\u5b9a\u3068\u306a\u308b\u306e\u3067\u9069\u5b9c\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/ul>\n<pre class=\"post-pre\"><code>#!\/bin\/bash\r\n\r\n# install CodeDeploy agent\r\nyum -y update\r\nyum install -y ruby\r\nyum install -y aws-cli\r\ncd \/home\/ec2-user\r\naws s3 cp s3:\/\/aws-codedeploy-us-east-1\/latest\/install . --region us-east-1\r\nchmod +x .\/install\r\n.\/install auto\r\n\r\n# install httpd\r\nyum install -y httpd\r\nchkconfig httpd on\r\nservice httpd start\r\n\r\n# install application dependencies\r\nyum install php php-mysql php-gd php-mbstring -y\r\nyum install mysql -y\r\n\r\n#exec sql\r\nmysql -u root -ppassword -h codedeploy.cukvcqdui8ox.us-east-1.rds.amazonaws.com &lt;&lt;EOF\r\nCREATE USER'wordpress-user'@'%' IDENTIFIED BY 'wordpress';\r\nCREATE DATABASE \\`wordpress\\`;\r\nGRANT ALL PRIVILEGES ON \\`wordpress\\`.*TO\"wordpress-user\"@\"%\";\r\nFLUSH PRIVILEGES;\r\nEOF\r\n<\/code><\/pre>\n<p>\u542f\u52a8\u540e\uff0c\u5f53StatusCheck\u53d8\u4e3arunning\u65f6\uff0c\u8fdb\u884cSSH\u8fde\u63a5\u5e76\u786e\u8ba4\u4ee3\u7406\u7a0b\u5e8f\u662f\u5426\u5df2\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code>$sudo service codedeploy-agent status\r\nThe AWS CodeDeploy agent is running as PID 6975\r\n<\/code><\/pre>\n<p>\u8bf7\u6839\u636e\u9700\u8981\uff0c\u67e5\u770b\/var\/log\/cloud-init-output.log\u4e2d\u7684\u65e5\u5fd7\u548c\u5176\u4ed6\u4e2d\u95f4\u4ef6\u7684\u914d\u7f6e\u3002<\/p>\n<h1>\u5c06\u7528\u4e8eCodeDeploy\u7684WordPress\u63a8\u9001\u5230GitHub<br \/>\n\u6b65\u9aa42\uff1a\u914d\u7f6e\u60a8\u7684\u6e90\u5185\u5bb9\u4ee5\u90e8\u7f72\u5230Amazon Linux\u6216Red Hat Enterprise Linux Amazon EC2\u5b9e\u4f8b\u3002<\/p>\n<p>\u4ee5\u4e0b\u5185\u5bb9\u5c06\u5728\u672c\u5730\u4e2a\u4eba\u7535\u8111\u4e0a\u8fdb\u884c\u3002<\/p>\n<p>\u6211\u4f1a\u514b\u9686WordPress\u7684\u6e90\u4ee3\u7801\u5230\u672c\u5730\u3002<\/p>\n<pre class=\"post-pre\"><code>$mkdir -p \/tmp\/WordPress\r\n$git clone https:\/\/github.com\/WordPress\/WordPress.git \/tmp\/WordPress\r\n<\/code><\/pre>\n<p>\u521b\u5efa\u7528\u4e8e\u811a\u672c\u914d\u7f6e\u7684\u6587\u4ef6\u5939\u3002<\/p>\n<pre class=\"post-pre\"><code>$mkdir -p \/tmp\/WordPress\/scripts\r\n<\/code><\/pre>\n<p>\u6211\u4f1a\u521b\u5efa\u4e00\u4e2a\u505c\u6b62httpd\u7684\u811a\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code>#!\/bin\/bash\r\nisExistApp=`pgrep httpd`\r\nif [[ -n  \\$isExistApp ]]; then\r\n   service httpd stop\r\nfi\r\n<\/code><\/pre>\n<p>\u6211\u8fd8\u4f1a\u7f16\u5199\u542f\u52a8httpd\u7684\u811a\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code>#!\/bin\/bash\r\nservice httpd start\r\n<\/code><\/pre>\n<p>\u6211\u8981\u521b\u5efa\u4e00\u4e2a\u811a\u672c\u6765\u66f4\u6539\u6743\u9650\u3002<\/p>\n<pre class=\"post-pre\"><code>#!\/bin\/bash\r\nchown -R apache:apache \/var\/www\/html\/WordPress\r\nchmod -R 744 \/var\/www\/html\/WordPress\r\n<\/code><\/pre>\n<p>\u4fee\u6539\u521b\u5efa\u7684\u811a\u672c\u96c6\u7684\u6743\u9650\u3002<\/p>\n<pre class=\"post-pre\"><code>$chmod +x \/tmp\/WordPress\/scripts\/*\r\n<\/code><\/pre>\n<p>\u5728appsec.yml\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u8bb0\u5f55\u4e0b\u6e90\u4ee3\u7801\u5e94\u8be5\u653e\u7f6e\u5728\u54ea\u91cc\uff0c\u4ee5\u53ca\u5728\u4f55\u79cd\u751f\u547d\u5468\u671f\u5b9a\u65f6\u4e2d\u5e94\u8be5\u505a\u4ec0\u4e48\u3002<\/p>\n<pre class=\"post-pre\"><code>version: 0.0\r\nos: linux\r\nfiles:\r\n  - source: \/\r\n    destination: \/var\/www\/html\/WordPress\r\nhooks:\r\n  AfterInstall:\r\n    - location: scripts\/change_permissions.sh\r\n      timeout: 300\r\n      runas: root\r\n  ApplicationStart:\r\n    - location: scripts\/start_server.sh\r\n      timeout: 300\r\n      runas: root\r\n  ApplicationStop:\r\n    - location: scripts\/stop_server.sh\r\n      timeout: 300\r\n      runas: root\r\n<\/code><\/pre>\n<p>\u8bf7\u53c2\u8003\u4ee5\u4e0b\u6709\u5173 appsec.yml \u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p>AWS CodeDeploy AppSpec\u6587\u4ef6\u53c2\u8003<\/p>\n<p>\u63a5\u4e0b\u6765\u5728Github\u4e0a\u521b\u5efa\u4ed3\u5e93\u3002<br \/>\n\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5728\u6d4f\u89c8\u5668\u4e2d\u9884\u5148\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a toshihirock\/CodeDeployWordPress \u7684\u4ed3\u5e93\u3002<\/p>\n<p>\u5728\u521b\u5efa\u4ed3\u5e93\u540e\uff0c\u5c06\u4ee3\u7801\u63a8\u9001\u5230GitHub\u3002<\/p>\n<pre class=\"post-pre\"><code>$cd \/tmp\/WordPress\r\n$git add .\r\n$git commit -m \"add codedeploy scripts\"\r\n$git remote rm origin\r\n$git remote add origin https:\/\/github.com\/toshihirock\/CodeDeployWordPress.git\r\n<\/code><\/pre>\n<h1>CodeDeploy\u8bbe\u7f6e\u9996\u5148\u6211\u4eec\u8981\u7528 CodeDeploy \u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a WordPress_App \u7684\u5e94\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>$aws deploy create-application --application-name WordPress_App --region us-east-1\r\n<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u90e8\u7f72\u7ec4\u3002\u5728\u6b64\u914d\u7f6e\u4e2d\uff0c\u6211\u4eec\u8bbe\u7f6e\u4e86\u8981\u5c06\u90e8\u7f72\u5230\u54ea\u4e9bEC2\u5b9e\u4f8b\u4e0a\u3002\u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3aWordPress_DepGroup\u7684\u90e8\u7f72\u9762\u548c\u7ec4\uff0c\u5b83\u6307\u793a\u8981\u5c06\u90e8\u7f72\u5230\u62e5\u6709EC2\u6807\u7b7eKey=Name\u3001Value=CodeDeployDemo\u7684EC2\u5b9e\u4f8b\u7fa4\u3002<\/p>\n<pre class=\"post-pre\"><code>$aws deploy create-deployment-group \\\r\n  --region us-east-1 \\\r\n  --application-name WordPress_App \\\r\n  --deployment-group-name WordPress_DepGroup \\\r\n  --deployment-config-name CodeDeployDefault.OneAtATime \\\r\n  --ec2-tag-filters Key=Name,Value=CodeDeployDemo,Type=KEY_AND_VALUE \\\r\n  --service-role-arn arn:aws:iam::hogefuga:role\/CodeDeployDemo\r\n<\/code><\/pre>\n<p>\u6700\u7ec8\u90e8\u7f72\u6e90\u4ee3\u7801\u3002\u8bf7\u6839\u636e\u9700\u8981\u5c06github-location\u9009\u9879\u66f4\u6539\u4e3a\u60a8\u81ea\u5df1\u7684\u5b58\u50a8\u5e93\u540d\u79f0\u548c\u76ee\u6807\u63d0\u4ea4ID\u3002<\/p>\n<pre class=\"post-pre\"><code>$aws deploy create-deployment \\\r\n  --region us-east-1 \\\r\n  --application-name WordPress_App \\\r\n  --deployment-config-name CodeDeployDefault.OneAtATime \\\r\n  --deployment-group-name WordPress_DepGroup \\\r\n  --github-location commitId=74e74ad4e0f80fb91a6034f3be58fce5b45d4a2c,repository=toshihirock\/CodeDeployWordPress\r\n<\/code><\/pre>\n<p>\u5982\u679c\u90e8\u7f72\u6210\u529f\uff0c\u6211\u8ba4\u4e3a\u53ef\u4ee5\u4f7f\u7528\u90e8\u7f72\u76ee\u6807EC2\u7684\u516c\u5171IP\u5730\u5740\u901a\u8fc7\u4ee5\u4e0bURL\u8fdb\u884c\u8bbf\u95ee\u3002<\/p>\n<h1>\u4e0eGitHub\u8fdb\u884c\u534f\u4f5c\u4f7f\u7528AWS CodeDeploy\u81ea\u52a8\u4eceGitHub\u90e8\u7f72<\/p>\n<p>\u9996\u5148\uff0c\u5728IAM\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aGitHub\u7684\u7528\u6237\u3002\u8bf7\u8bb0\u4e0b\u5728\u521b\u5efa\u7528\u6237\u8fc7\u7a0b\u4e2d\u663e\u793a\u51fa\u6765\u7684Access Key ID\u548cSecret Access key\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u5011\u5c07\u4ee5\u4e0b\u653f\u7b56\u4f5c\u70baCustomPolicy\u9644\u52a0\u7d66\u4e0a\u8ff0\u7528\u6236\u3002PolicyName\u70baCodeDeploy-Access\u3002\u8acb\u6ce8\u610f\uff0c\u8acb\u5c07123ACCOUNTID\u90e8\u5206\u66f4\u6539\u70ba\u60a8\u81ea\u5df1\u7684AWS\u5e33\u865fID\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">IAM-&gt;Users-&gt;GitHub-&gt;InlinePolicies-&gt;click here<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Custom Policy<\/ul>\n<pre class=\"post-pre\"><code>{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": \"codedeploy:GetDeploymentConfig\",\r\n      \"Resource\": \"arn:aws:codedeploy:us-east-1:123ACCOUNTID:deploymentconfig:*\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": \"codedeploy:RegisterApplicationRevision\",\r\n      \"Resource\": \"arn:aws:codedeploy:us-east-1:123ACCOUNTID:application:WordPress_App\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": \"codedeploy:GetApplicationRevision\",\r\n      \"Resource\": \"arn:aws:codedeploy:us-east-1:123ACCOUNTID:application:WordPress_App\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": \"codedeploy:CreateDeployment\",\r\n      \"Resource\": \"arn:aws:codedeploy:us-east-1:123ACCOUNTID:deploymentgroup:WordPress_App\/WordPress_DepGroup\"\r\n    }\r\n  ]\r\n}\r\n<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\u8fdb\u884cGitHub\u7684\u914d\u7f6e\u3002\u6dfb\u52a0AWS CodeDeploy\u670d\u52a1\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitHub\u306e\u30da\u30fc\u30b8\u3067\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u9078\u629e(\u79c1\u306e\u5834\u5408\u3001toshihirock\/CodeDeployWordPress)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Settings<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Webhooks and Services<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Add Services-&gt;AWS CodeDeploy<\/ul>\n<p>\u4ee5\u4ee5\u4e0b\u65b9\u5f0f\u6dfb\u52a0\u9879\u76ee\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Screen Shot 2015-07-20 at 6.56.36 AM.png\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/72-0.png\" alt=\"Screen Shot 2015-07-20 at 6.56.36 AM.png\" \/><br \/>\n\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u83b7\u53d6GitHub\u7684\u8bbf\u95ee\u4ee4\u724c\u3002<\/p>\n<p>\u663e\u793a\u4e2a\u4eba\u8bbf\u95ee\u4ee4\u724c\u5e76\u9009\u62e9\u751f\u6210\u4e2a\u4eba\u8bbf\u95ee\u4ee4\u724c\uff0c\u7136\u540e\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Screen Shot 2015-07-20 at 7.03.50 AM.png\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/75-0.png\" alt=\"Screen Shot 2015-07-20 at 7.03.50 AM.png\" \/>\u8a2d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u8acb\u8a18\u4e0b\u986f\u793a\u7684\u4ee4\u724c\u8cc7\u8a0a\u3002<\/p>\n<p>\u8bf7\u91cd\u65b0\u8f6c\u5230\u5148\u524d\u8bbe\u7f6eCodeDeploy\u670d\u52a1\u7684\u9875\u9762\uff0c\u5e76\u6dfb\u52a0GitHub\u81ea\u52a8\u90e8\u7f72\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitHub\u306e\u30da\u30fc\u30b8\u3067\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u9078\u629e(\u79c1\u306e\u5834\u5408\u3001toshihirock\/CodeDeployWordPress)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Settings<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Webhooks and Services<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Add Services-&gt;GitHub Auto-Deployment<\/ul>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Screen Shot 2015-07-20 at 7.57.00 AM.png\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/79-0.png\" alt=\"Screen Shot 2015-07-20 at 7.57.00 AM.png\" \/>\u6211\u8ba4\u4e3a\uff0c\u5728\u5236\u4f5c\u5b8c\u6210\u540e\uff0c\u4ee5\u4e0b\u4e24\u9879\u670d\u52a1\u5df2\u7ecf\u88ab\u8bbe\u7f6e\u597d\u4e86\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Screen Shot 2015-07-20 at 9.23.48 AM.png\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/81-0.png\" alt=\"Screen Shot 2015-07-20 at 9.23.48 AM.png\" \/>\u56e0\u4e3a\u51c6\u5907\u5de5\u4f5c\u5df2\u7ecf\u5b8c\u6210\uff0c\u6240\u4ee5\u6211\u5c06\u5c1d\u8bd5\u5411WordPress\u4ed3\u5e93\u63d0\u4ea4\u4ee3\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code>$cd \/tmp\/WordPress\r\n$git commit --allow-empty -m \"test CodeDeploy\"\r\n$git push origin master\r\n$git log -1\r\ncommit b74c07c54a747fd9a44be09031bcd272ae749bed\r\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c\u60a8\u53ef\u4ee5\u68c0\u67e5CodeDeploy\u754c\u9762\u4ee5\u786e\u8ba4\u5148\u524d\u63d0\u4ea4ID\u7684\u4fee\u8ba2\u7248\u6e90\u4ee3\u7801\u662f\u5426\u5df2\u90e8\u7f72\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Screen Shot 2015-07-20 at 8.03.23 AM.png\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/85-0.png\" alt=\"Screen Shot 2015-07-20 at 8.03.23 AM.png\" \/><\/p>\n<h1>\u6700\u540e\u6211\u6700\u8fd1\u5c1d\u8bd5\u4e86CodeDeploy\uff0c\u53d1\u73b0\u5728GitHub\u6302\u94a9\u7684\u65f6\u5019\u53ef\u4ee5\u8fdb\u884c\u90e8\u7f72\u975e\u5e38\u65b9\u4fbf\u3002\u800c\u4e14\u4e0d\u9700\u8981\u592a\u8fc7\u5173\u6ce8CodeDeploy\u672c\u8eab\u7684\u7ba1\u7406\uff0c\u8fd9\u771f\u662f\u592a\u8f7b\u677e\u4e86\u3002<\/p>\n<p>\u6211\u5f88\u5e0c\u671b\u80fd\u591f\u5feb\u901f\u4e0eCodeCommit\u8fdb\u884c\u96c6\u6210\uff0c\u5e76\u5728VPC\u7aef\u70b9\u4e0a\u5b9e\u73b0CodeDeploy\u548cCodeCommit\uff0c\u4f7f\u5176\u53ef\u4ee5\u4ece\u79c1\u6709\u5b50\u7f51\u4e2d\u8fdb\u884c\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8003\u8651\u5230\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u65f6\uff0c\u6211\u60f3\u53ef\u80fd\u6709\u5404\u79cd\u9009\u62e9\u3002\u4ee5\u4e0b\u662f\u603b\u7ed3\u7684\u9009\u9879\u3002 \u603b\u7ed3\u5728AWS\u4e0a\u5b9e\u73b0\u90e8\u7f72\u548c\u81ea\u52a8\u6269\u5c55\u7684\u65b9\u6cd5 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-27234","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528codedeploy\u5728github\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230ec2\u4e0a\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528codedeploy\u5728github\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230ec2\u4e0a\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-17T11:24:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-11T17:32:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/72-0.png\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/\",\"name\":\"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-11-17T11:24:32+00:00\",\"dateModified\":\"2025-08-11T17:32:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"description\":\"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a - Blog - Silicon Cloud","description":"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528codedeploy\u5728github\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230ec2\u4e0a\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a","og_description":"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528codedeploy\u5728github\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230ec2\u4e0a\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-17T11:24:32+00:00","article_modified_time":"2025-08-11T17:32:48+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cf4cf37434c4406ba9f77\/72-0.png"}],"author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/","name":"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-11-17T11:24:32+00:00","dateModified":"2025-08-11T17:32:48+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"description":"\u5173\u4e8e\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528CodeDeploy\u5728GitHub\u63a8\u9001\u65f6\u5c06\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5230EC2\u4e0a"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8codedeploy%e5%9c%a8github%e6%8e%a8%e9%80%81%e6%97%b6%e5%b0%86%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e9%83%a8%e7%bd%b2%e5%88%b0ec2%e4%b8%8a%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/27234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=27234"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/27234\/revisions"}],"predecessor-version":[{"id":111090,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/27234\/revisions\/111090"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=27234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=27234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=27234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}