{"id":3919,"date":"2021-02-07T13:31:34","date_gmt":"2021-02-07T12:31:34","guid":{"rendered":"http:\/\/miro.borodziuk.eu\/?p=3919"},"modified":"2021-05-20T20:04:57","modified_gmt":"2021-05-20T18:04:57","slug":"codedeploy","status":"publish","type":"post","link":"http:\/\/miro.borodziuk.eu\/index.php\/2021\/02\/07\/codedeploy\/","title":{"rendered":"CodeDeploy"},"content":{"rendered":"<p><!--more--><\/p>\n<ul>\n<li>We want to deploy our application automatically to many EC2 instances<\/li>\n<li>There are several ways to handle deployments using open source tools (Ansible, Terraform, Chef, Puppet, etc\u2026)<\/li>\n<li>We can use the managed Service AWS CodeDeploy<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3924 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy1.jpg\" alt=\"\" width=\"403\" height=\"526\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy1.jpg 403w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy1-230x300.jpg 230w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/li>\n<li>Each EC2 Machine (or On Premise machine) must be running the<br \/>\nCodeDeploy Agent<\/li>\n<li>The agent is continuously polling AWS CodeDeploy for work to do<\/li>\n<li>CodeDeploy sends <code>appspec.yml<\/code> file.<\/li>\n<li>Application is pulled from GitHub or S3<\/li>\n<li>EC2 will run the deployment instructions<\/li>\n<li>CodeDeploy Agent will report of success \/ failure of deployment on<br \/>\nthe instance<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3925 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy2.jpg\" alt=\"\" width=\"892\" height=\"796\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy2.jpg 892w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy2-300x268.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy2-768x685.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<ul>\n<li>EC2 instances are grouped by deployment group (dev \/ test \/ prod)<\/li>\n<li>Lots of flexibility to define any kind of deployments<\/li>\n<li>CodeDeploy can be chained into CodePipeline and use artifacts from<br \/>\nthere<\/li>\n<li>CodeDeploy can re-use existing setup tools, works with any application,<br \/>\nauto scaling integration<\/li>\n<li>Note: Blue \/ Green only works with EC2 instances (not on premise)<\/li>\n<li>Support for AWS Lambda deployments, EC2<\/li>\n<li>CodeDeploy does not provision resources<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">EC2 Setup<\/span><\/p>\n<p>Because EC2 will read data from S3 we need to create and assign S3ReadOnly Role.<\/p>\n<p><code>IAM -&gt; Create role -&gt; EC2 -&gt; AmazonS3ReadOnlyAccess -&gt; Next -&gt; Review -&gt; Role Name (S3ReadOnly) -&gt; Create role<\/code><\/p>\n<p>First we need to launch EC2 instance.<\/p>\n<p><code>EC2 -&gt; Launchh instance -&gt; Amazon Linux 2 AMI (HVM), SSD Volume Type -&gt; Select -&gt; T2.micro -&gt; Configure instance details -&gt;<\/code> <code><\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3929 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy3-1.jpg\" alt=\"\" width=\"815\" height=\"713\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy3-1.jpg 815w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy3-1-300x262.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy3-1-768x672.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>You can use existing key pair and default security group.<\/p>\n<p>EC2 instance is running and we need to connect to it and install CodeDeploy agent. Choose your instance from list and click <code>Connect<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3933 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy4-1.jpg\" alt=\"\" width=\"1222\" height=\"172\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy4-1.jpg 1222w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy4-1-300x42.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy4-1-1024x144.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy4-1-768x108.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>and then again<code> Connect<\/code>.\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3935 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy5-1.jpg\" alt=\"\" width=\"730\" height=\"547\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy5-1.jpg 730w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy5-1-300x225.jpg 300w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>After you connect to the instance run following commands:<\/p>\n<pre class=\"lang:default decode:true\"># Installing the CodeDeploy agent on EC2\r\n\r\nsudo yum update -y\r\nsudo yum install -y ruby wget\r\nwget https:\/\/aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com\/latest\/install\r\nchmod +x .\/install\r\nsudo .\/install auto\r\nsudo service codedeploy-agent status<\/pre>\n<p>This is the output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3937 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy6.jpg\" alt=\"\" width=\"1314\" height=\"820\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy6.jpg 1314w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy6-300x187.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy6-1024x639.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy6-768x479.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Codebuild agent has been installed and his proces id is 3857.<\/p>\n<p>We also need to give a tags to the instance:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3940 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy7.jpg\" alt=\"\" width=\"725\" height=\"344\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy7.jpg 725w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy7-300x142.jpg 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Application and Deployment Group<\/span><\/p>\n<p><code>Create Application -&gt; Application name [CodeDeployDemo] -&gt; Compute platform [EC2\/OnPremises] -&gt; Create Application<\/code><\/p>\n<p>First we need\u00a0 a role with CodeDeploy permissions that grants AWS CodeDeploy access to your target instances.<\/p>\n<p><code>IAM -&gt; Roles -&gt; Create role -&gt; CodeDeploy (Allows CodeDeploy to call AWS services such as Auto Scaling on your behalf) -&gt; Next: Permissions -&gt; <span class=\"permissions-step ng-scope\"><span class=\"with-required-policies ng-scope\"><span class=\"required-policies-table ng-scope\"><span class=\"awsui-tooltip awsui-tooltip-no-slide awsui-tooltip-right awsui-tooltip-rounded awsui-tooltip-size-auto\" aria-label=\"AWSCodeDeployRole\" data-awsui-tooltip-text=\"AWSCodeDeployRole\"><span class=\"ng-scope policy-name-with-icon\">AWSCodeDeployRole -&gt; Next -&gt; Next -&gt; Role name [CodeDeployRole] -&gt; Create role<\/span><\/span><\/span><\/span><\/span><\/code><\/p>\n<p>Also we need S3 bucket where deployment puts files:<\/p>\n<pre class=\"lang:default decode:true\">C:\\Users\\mirth&gt;aws configure --profile aws-devops\r\nAWS Access Key ID [None]: AKIA4HFREL3PLYD2XT7N\r\nAWS Secret Access Key [None]: 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\r\nDefault region name [None]: eu-central-1\r\nDefault output format [None]: json\r\n\r\nC:\\Users\\mirth&gt;aws s3 mb s3:\/\/aws-devops-course-miro --region eu-central-1 --profile aws-devops\r\nmake_bucket: aws-devops-course-miro\r\n\r\nC:\\Users\\mirth&gt;aws s3api put-bucket-versioning --bucket aws-devops-course-miro --versioning-configuration Status=Enabled --region eu-central-1 --profile aws-devops<\/pre>\n<p>From inside my-webpage katalog we should zip and send files to the s3 bucket aws-devops-course-miro:<\/p>\n<pre class=\"lang:default decode:true\">C:\\Users\\mirth&gt;d:\r\nD:\\&gt;cd aws\r\nD:\\AWS&gt;cd code\r\nD:\\AWS\\code&gt;cd my-webpage\r\nD:\\AWS\\code\\my-webpage&gt;dir\r\n Volume in drive D has no label.\r\n Volume Serial Number is 1DD6-4320\r\n\r\n Directory of D:\\AWS\\code\\my-webpage\r\n\r\n2021-02-08  12:47    &lt;DIR&gt;          .\r\n2021-02-08  12:47    &lt;DIR&gt;          ..\r\n2019-09-12  16:46               570 appspec.yml\r\n2019-09-12  16:46               501 buildspec.yml\r\n2019-09-12  16:46               754 CODEDEPLOY.md\r\n2019-09-12  16:46               717 index.html\r\n2021-02-08  12:47    &lt;DIR&gt;          scripts\r\n               4 File(s)          2\u00a0542 bytes\r\n               3 Dir(s)  84\u00a0782\u00a0022\u00a0656 bytes free\r\n\r\nD:\\AWS\\code\\my-webpage&gt;\r\n\r\nD:\\AWS\\code\\my-webpage&gt;aws deploy push --application-name CodeDeployDemo --s3-location s3:\/\/aws-devops-course-miro\/codedeploy-demo\/app.zip --ignore-hidden-files --region eu-central-1 --profile aws-devops\r\nTo deploy with this revision, run:\r\naws deploy create-deployment --application-name CodeDeployDemo --s3-location bucket=aws-devops-course-miro,key=codedeploy-demo\/app.zip,bundleType=zip,eTag=5584c7b6bcad9c26a14492a3ecc773d0,version=QdMLpFvLcPUqvbB0mLlyNj6l0qIrhwAd --deployment-group-name &lt;deployment-group-name&gt; --deployment-config-name &lt;deployment-config-name&gt; --description &lt;description&gt;\r\n\r\nD:\\AWS\\code\\my-webpage&gt;<\/pre>\n<p>As we see in the s3 bucket aws-devops-course-miro we now have files:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3951 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy10.jpg\" alt=\"\" width=\"796\" height=\"443\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy10.jpg 796w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy10-300x167.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy10-768x427.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>In order to create a new deployment, you must first create a deployment group.<\/p>\n<p><code>Create Deployment Group -&gt; Deployment group name [MyDevelopmentInstances] -&gt; Service role [CodeDeployRole] -&gt; Deployment type [In Place] -&gt; Environment Configuration -&gt; Amazon EC2 Instances -&gt; Key Value [Environment Development] -&gt;<\/code><\/p>\n<p>We have 1 unique matched instance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3946 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy8.jpg\" alt=\"\" width=\"720\" height=\"637\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy8.jpg 720w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy8-300x265.jpg 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3948 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy9.jpg\" alt=\"\" width=\"719\" height=\"163\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy9.jpg 719w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy9-300x68.jpg 300w\" sizes=\"(max-width: 719px) 100vw, 719px\" \/><\/p>\n<p><code>-&gt; Deployment Configuration [CodeDeployDefaultAllAtOnce] -&gt; Disable Load Balancing -&gt; Create Deployment Group<\/code><\/p>\n<p>Deployment group has been created and now we need a deployment.<\/p>\n<p><code>Create deployment -&gt; Deployment group [MyDevelopmentInstances]<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3954 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy11.jpg\" alt=\"\" width=\"729\" height=\"658\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy11.jpg 729w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy11-300x271.jpg 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/p>\n<p><code>-&gt; Create deployment<\/code>.<\/p>\n<p>Deployment has been created.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3955 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy12.jpg\" alt=\"\" width=\"958\" height=\"827\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy12.jpg 958w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy12-300x259.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy12-768x663.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>And application is running on the EC2 instance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3957 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy13.jpg\" alt=\"\" width=\"1005\" height=\"304\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy13.jpg 1005w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy13-300x91.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy13-768x232.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Additional deployment groups<\/span><\/p>\n<p>We can launch more instances like which was launched before to create more deploment groups.<\/p>\n<p><code>EC2 -&gt; Actions -&gt; Image and templates -&gt; Launch more like this -&gt; Edit instance details -&gt; Number of Instances [4] -&gt; in User data -&gt;<\/code><\/p>\n<pre class=\"lang:default decode:true \">sudo yum update -y\r\nsudo yum install -y ruby wget\r\nwget https:\/\/aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com\/latest\/install\r\nchmod +x .\/install\r\nsudo .\/install auto\r\nsudo service codedeploy-agent status\r\n<\/pre>\n<p><code>-&gt; Review and Launch -&gt; Launch -&gt; Choose key pair<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3960 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy14.jpg\" alt=\"\" width=\"863\" height=\"734\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy14.jpg 863w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy14-300x255.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy14-768x653.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Modify tags for three of running instances. Three instances must have &#8220;environment -&gt; production&#8221; tags and two of them &#8220;development&#8221; tags.<\/p>\n<p>Go to the CodeDeploy and run new deployment group for application CodeDeployDemo.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3961 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy17.jpg\" alt=\"\" width=\"810\" height=\"595\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy17.jpg 810w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy17-300x220.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy17-768x564.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>The same role:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3962 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18.jpg\" alt=\"\" width=\"813\" height=\"815\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18.jpg 813w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18-300x300.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18-150x150.jpg 150w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18-768x770.jpg 768w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy18-100x100.jpg 100w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Add to deployment group instances tagged as production:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3963 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy19.jpg\" alt=\"\" width=\"805\" height=\"713\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy19.jpg 805w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy19-300x266.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy19-768x680.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Remove load balancer and click on <code>Create deployment group<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3964 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy20.jpg\" alt=\"\" width=\"803\" height=\"186\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy20.jpg 803w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy20-300x69.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy20-768x178.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Now we have 2 deployments group for application <a class=\"awsui-breadcrumb-link\" href=\"https:\/\/eu-central-1.console.aws.amazon.com\/codesuite\/codedeploy\/applications\/CodeDeployDemo?region=eu-central-1\" aria-current=\"page\" aria-disabled=\"true\"><span class=\"awsui-breadcrumb-link-text\">CodeDeployDemo<\/span><\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3966 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy21.jpg\" alt=\"\" width=\"832\" height=\"643\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy21.jpg 832w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy21-300x232.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy21-768x594.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Now let&#8217;s deploy the application o new deployment group:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3968 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy22.jpg\" alt=\"\" width=\"696\" height=\"595\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy22.jpg 696w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy22-300x256.jpg 300w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3969 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23.jpg\" alt=\"\" width=\"702\" height=\"733\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23.jpg 702w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23-287x300.jpg 287w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/p>\n<p>We have problem\u00a0 in deployment:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3970 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy24.jpg\" alt=\"\" width=\"753\" height=\"471\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy24.jpg 753w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy24-300x188.jpg 300w\" sizes=\"(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/p>\n<p>So in the deplyments settings we need to change the configuration:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3971 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy25.jpg\" alt=\"\" width=\"824\" height=\"201\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy25.jpg 824w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy25-300x73.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy25-768x187.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>After we change this setting we should again create deployment:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3969 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23.jpg\" alt=\"\" width=\"702\" height=\"733\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23.jpg 702w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy23-287x300.jpg 287w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Appspec.yml file.<\/span><\/p>\n<p>On the deployment we used such an<code> appsppec.yml<\/code> file:<\/p>\n<pre class=\"lang:default decode:true\">version: 0.0\r\nos: linux\r\nfiles:\r\n  - source: \/index.html\r\n    destination: \/var\/www\/html\/\r\nhooks:\r\n  ApplicationStop:\r\n    - location: scripts\/stop_server.sh\r\n      timeout: 300\r\n      runas: root\r\n  AfterInstall:\r\n    - location: scripts\/after_install.sh\r\n      timeout: 300\r\n      runas: root\r\n  BeforeInstall:\r\n    - location: scripts\/install_dependencies.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  ValidateService:\r\n    - location: scripts\/validate_service.sh\r\n      timeout: 300\r\n<\/pre>\n<p>Files section means that de deploy will copy <code>index.html<\/code> file to the <code>\/var\/www\/html<\/code> destination.<\/p>\n<p>ApplicationStop hook:<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\nisExistApp=`pgrep httpd`\r\nif [[ -n  $isExistApp ]]; then\r\n    service httpd stop        \r\nfi\r\n<\/pre>\n<p>Check if httpd proces is running. If yes the stop it.<\/p>\n<p>AfterInstall hook:<\/p>\n<pre class=\"lang:default decode:true\">#!\/bin\/bash\r\nEC2_INSTANCE_ID=$(curl -s http:\/\/169.254.169.254\/latest\/meta-data\/instance-id)\r\nEC2_AZ=$(curl -s http:\/\/169.254.169.254\/latest\/meta-data\/placement\/availability-zone)\r\nsed -i \"s\/was deployed\/was deployed on $EC2_INSTANCE_ID in $EC2_AZ\/g\" \/var\/www\/html\/index.html\r\nchmod 664 \/var\/www\/html\/index.html<\/pre>\n<p>Copy instance id and instance availability zone from instance metadata. Puts info to the <code>index.html<\/code> file.\u00a0 Change the permissons to the index.html file.<\/p>\n<p>BeforeInstall hook:<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\nyum install -y httpd<\/pre>\n<p>Install apache server.<\/p>\n<p>ApplicationStart hook:<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\nservice httpd start<\/pre>\n<p>Starts apache serwer.<\/p>\n<p>ValidateService hook:<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\n# verify we can access our webpage successfully\r\ncurl -v --silent localhost:80 2&gt;&amp;1 | grep Congratulations<\/pre>\n<p>Check if on the local web server there is &#8220;Congratulations&#8221; word.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Monitoring deployments with Amazon CloudWatch Events<\/span><\/p>\n<p>You can use Amazon CloudWatch Events to detect and react to changes in the state of an instance or a deployment (an &#8220;event&#8221;) in your CodeDeploy operations.<\/p>\n<p><code>CloudWatch -&gt; Events -&gt; Rules -&gt; Create rule<\/code><\/p>\n<p>First you need to create a Lambda function to pass a notification to a Slack channel whenever deployments fail and then:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3984 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28b.jpg\" alt=\"\" width=\"773\" height=\"722\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28b.jpg 773w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28b-300x280.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28b-768x717.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3983 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28a.jpg\" alt=\"\" width=\"770\" height=\"303\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28a.jpg 770w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28a-300x118.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy28a-768x302.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>We can use CloudWatch alarm actions to automatically stop, terminate, reboot, or recover Amazon EC2 instances when a deployment or instance event you specify occurs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3986 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29a.jpg\" alt=\"\" width=\"763\" height=\"747\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29a.jpg 763w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29a-300x294.jpg 300w\" sizes=\"(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3987 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29b.jpg\" alt=\"\" width=\"754\" height=\"561\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29b.jpg 754w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy29b-300x223.jpg 300w\" sizes=\"(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Monitoring deployments with SNS.<\/span><\/p>\n<p>You can add triggers to a CodeDeploy deployment group to receive notifications about events related to deployments or instances in that deployment group. These notifications are sent to recipients who are subscribed to an Amazon SNS topic you have made part of the trigger&#8217;s action.<\/p>\n<p><code>Developer Tools -&gt; CodeDeploy -&gt; Applications -&gt; CodeDeployDemo -&gt; MyProductionInstances -&gt; Edit -&gt; Advanced - optional -&gt; Create Trigger<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3978 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy26.jpg\" alt=\"\" width=\"604\" height=\"626\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy26.jpg 604w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy26-289x300.jpg 289w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\n<p><code>Create trigger -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3979 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy27.jpg\" alt=\"\" width=\"814\" height=\"603\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy27.jpg 814w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy27-300x222.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy27-768x569.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Save Changes -&gt;<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Rollbacks.<\/span><\/p>\n<p>You can configure a deployment group or deployment to automatically roll back when a deployment fails or when a monitoring threshold you specify is met.<\/p>\n<p><code>Developer Tools -&gt; CodeDeploy -&gt; Applications -&gt; CodeDeployDemo -&gt; MyProductionInstances -&gt; Edit -&gt; Advanced - optional<\/code><\/p>\n<p>If we want to rollback only when a deploments fails we should use such a configuration:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3992 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy31.jpg\" alt=\"\" width=\"802\" height=\"207\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy31.jpg 802w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy31-300x77.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy31-768x198.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>If we want to rollback based on alarm thresholds:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3991 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy30.jpg\" alt=\"\" width=\"812\" height=\"206\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy30.jpg 812w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy30-300x76.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy30-768x195.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>We should create an CloudWatch alarm first:<\/p>\n<p><code>CloudWatch -&gt; Alarms -&gt; Create alarm -&gt; Select metric -&gt; EC2 -&gt; Per instance -&gt; CPUUtulization -&gt; Select metric<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3993 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy32.jpg\" alt=\"\" width=\"1108\" height=\"697\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy32.jpg 1108w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy32-300x189.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy32-1024x644.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy32-768x483.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Conditions -&gt; Grater than 70 -&gt; Next<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3994 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy33.jpg\" alt=\"\" width=\"774\" height=\"536\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy33.jpg 774w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy33-300x208.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy33-768x532.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Choose a SNS Topic:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3995 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy34.jpg\" alt=\"\" width=\"793\" height=\"633\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy34.jpg 793w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy34-300x239.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy34-768x613.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Next -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3996 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy35.jpg\" alt=\"\" width=\"787\" height=\"439\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy35.jpg 787w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy35-300x167.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy35-768x428.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Create alarm -&gt;<\/code><\/p>\n<p>After we have created an alarm we can add it to alarms:<\/p>\n<p><code>Add alarm -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3998 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy36.jpg\" alt=\"\" width=\"588\" height=\"390\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy36.jpg 588w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy36-300x199.jpg 300w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><\/p>\n<p><code>Add alarm -&gt; X<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3999 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy37.jpg\" alt=\"\" width=\"799\" height=\"271\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy37.jpg 799w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy37-300x102.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy37-768x260.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>If alarm goes up the deployment will be rolled back.<\/p>\n<p><code>Save changes -&gt;<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">On-Premise Instances Setup<\/span><\/p>\n<p>An on-premises instance have to run the CodeDeploy agent and connect to public AWS service endpoints.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Deploy to AWS Lambda<\/span><\/p>\n<p><code>Developer Tools -&gt; CodeDeploy -&gt; Applications -&gt; Create application<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4003 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy38.jpg\" alt=\"\" width=\"815\" height=\"415\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy38.jpg 815w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy38-300x153.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy38-768x391.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>-&gt; Create application<\/code><\/p>\n<p>Now we need to create a specific role for CodeDeploy to Lambda.<\/p>\n<p><code>IAM -&gt; Roles -&gt; Create role -&gt; CodeDeploy -&gt; CodeDeploy for Lambda -&gt; Next: Permissions<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4004 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy39.jpg\" alt=\"\" width=\"983\" height=\"282\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy39.jpg 983w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy39-300x86.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy39-768x220.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Next: Tags -&gt; Next: Review<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4005 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy40.jpg\" alt=\"\" width=\"974\" height=\"492\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy40.jpg 974w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy40-300x152.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy40-768x388.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Create role -&gt;<\/code><\/p>\n<p><code>Developer Tools -&gt; CodeDeploy -&gt; Applications -&gt; LambdaDeploymentApplication -&gt; Create deployment group<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4007 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy41.jpg\" alt=\"\" width=\"818\" height=\"833\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy41.jpg 818w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy41-295x300.jpg 295w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodeDeploy41-768x782.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Create Deployment Group -&gt;<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>References<br \/>\n<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/APIReference\/API_MinimumHealthyHosts.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/APIReference\/API_MinimumHealthyHosts.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#appspec-hooks-server\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#appspec-hooks-server<\/a><\/li>\n<li><a href=\"https:\/\/docs.amazonaws.cn\/en_us\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#reference-appspec-file-structure-environment-variable-availability\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.amazonaws.cn\/en_us\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#reference-appspec-file-structure-environment-variable-availability<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/monitoring-cloudwatch-events.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/monitoring-cloudwatch-events.html<\/a><\/li>\n<li><a href=\"https:\/\/aws.amazon.com\/blogs\/devops\/view-aws-codedeploy-logs-in-amazon-cloudwatch-console\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/aws.amazon.com\/blogs\/devops\/view-aws-codedeploy-logs-in-amazon-cloudwatch-console\/<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/monitoring-sns-event-notifications.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/monitoring-sns-event-notifications.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployments-rollback-and-redeploy.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployments-rollback-and-redeploy.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-groups-configure-advanced-options.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-groups-configure-advanced-options.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/instances-on-premises.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/instances-on-premises.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/register-on-premises-instance-iam-user-arn.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/register-on-premises-instance-iam-user-arn.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/register-on-premises-instance-iam-session-arn.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/register-on-premises-instance-iam-session-arn.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-configurations.html#deployment-configuration-lambda\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-configurations.html#deployment-configuration-lambda<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#appspec-hooks-lambda\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/reference-appspec-file-structure-hooks.html#appspec-hooks-lambda<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":3923,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[],"_links":{"self":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3919"}],"collection":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/comments?post=3919"}],"version-history":[{"count":35,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3919\/revisions"}],"predecessor-version":[{"id":3927,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3919\/revisions\/3927"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media\/3923"}],"wp:attachment":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media?parent=3919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/categories?post=3919"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/tags?post=3919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}