image block
1873 Views 148 Comments
Hi guys!
I hope you miss me a bit :) Now I'm here.
And today I'm gonna to explain the simplest way to implement CD process inside Amazon Web Services. So let's start.


AWS CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances.
And it's actually cool because there are no needed to install additional soft for developing and maintaining our applications on the cloud. And also there is no limit on application content (configuration, multimedia or executable files) and big scope of sources.
As a source, we can use any provided by AWS systems: AWS S3, GitHub or Bitbucket repositories. In this case, we gonna use simple script by installation of Apache on our EC2 hosts and run simple start page from GitHub repository.
One more not less important thing which we will use on this post is IAM.
AWS Identity and Access Management (IAM) - is management system which give you possibility to control the access to AWS services and resources securely. Functionality of this system provide management not only for individual users, but for groups. And due them we can specify any role, any permission and sharing or denied any resources.
So, let's get start to configuring the system.

Users and roles

First what we gonna do, it's creation of two roles which we will use. The first role will use for contacting with our source (in our case it will be GitHub) and the second one which will working with our EC2 machines.
To do this, click on services of AWS and select IAM.

There is general page of IAM service. For creation new role, choose Roles and push on Create role button. Policies we will create during this process.
Specify that we are going to create role for our CodeDeploy on EC2 instances.

And in this step we will create new policies for out user, so click on "Create Policy".

You can choose any needed roles on list given by AWS, but for more clear understanding, better use direct specified permissions by JSON. To do this, click on JSON tab and specify needed permissions.
My example of these permissions you can download here (Policy Permissions).
And you will see confirmation that your policy has been created.

Great. We can continue creation of our role. The next step is specifying the name and the description to role, after this, we will get it on our AWS system.
Please do the same for the second role with permissions on installation our code on EC2 instances. My example you have find here (Policy Permissions).
Awesome! Now we have two roles, which we will use on our AWS Deploy. One role for manipulating with EC2 instances and one for working with CodeDeploy.
But we have to do one more thing. We should add "Trusted policy" to these roles. These rules are showing, to which AWS services you are giving access to this role. Without them, you will see the error like this :
To add these trust policies, just click on your role, go to tab "Trust relationships" and click on edit button.
My example of these policies, you can find on files specified before in section "Policy Trust Permissions".
Now we have two working roles and we can move on.

AWS CodeDeploy

Ok, and in the start of configuring our CodeDeploy, we should create EC2 instance. If you don't know how to do this, please read first part of introduction to AWS by this link : Amazon Web Services Part 1 - Monitoring
The next step is installing of CodeDeploy agent on our node. To do this, please login on host and run these commands ( in our case is Centos OS ) :
yum -y update .   # getting latest updates of os
yum install -y aws-cli    # installing aws command line libraries  
aws configure    # and configuring them
aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1  # setup location and access
chmod +x ./install    # giving execute permissions on install script
./install auto    # installing CodeDeploy agent
Now we have installed and configured CodeDeploy agent on our machine. So, like the last step here, we need to start it and ensure that it's running.
systemctl start codedeploy-agent
systemctl status codedeploy-agent
And after this you should see the process of agent, like present on my screenshot.

Nice! Let's create our first deployment.
In this post, we are going to automate process of installing Apache on our new instances, and also changing index.html file on our. How we can do this? Let's move on and will see :)
Go on our AWS panel to CodeDeploy and click on "Get Started Now" button.
And here we are, on page of creation of new deployment.
On next page, you can choose the type of deployment via CodeDeploy, and of course if you want, you can choose with more detailed manual and less flexible type "Sample" type of deployment, but for us needed "Custom" type, so choose this one and move on.

On next page, you should specify the name of your deployment and group. And lower you will have table with EC2 instances, where you can choose any instance (or group instances by tags) on which one you want to implement CodeDeploy.
On this step, please have a more attention, because if you will choose tag witch are connected to few of your EC2 instances, that the changes will be implemented on all of them, when you will run deployment.
On deployment configuration, you can choose on from 3 default types of deployment, Due selected type, the installation on your EC2 hosts, will be one by one or in parallel so on.

On services role, choose our created before EC2Deploy role.

And here we go! We have created our first deployment. Cool!


Now we can try to deploy our application. So, click on the "Actions" and "Deploy new revision".

Like a source, for this post, we will use GitHub, but you also can connect your AWS S3 database.
You should connect your GitHub account to AWS, and like repository of source and commit ID, specify needed your data, but we're going to use data from my GitHub account, so you can just copy it, and have a look how it works.
Like repository name you should specify GitHub repo name and also owner of this repo. And on commit space paste just last commit, you can find it here.

And when we click on deploy button, it will deploy our application on EC2 hosts.

Let's check our EC2 instance.

Amazing! Everything is working! But how it know, what should be done?
Logic of CodeDeploy is very simple. It's trying to get needed source (in our case this is GitHub), and get "init" file, which in CodeDeploy case, should be named appspec.yml. The same file is stored on GItHub which we specified, on root directory. There is example of it.
version: 0.0
os: linux
   - source: /CodeDeploy/
     destination: /var/www/html
   - object: /var/www/html
     pattern: "**"
     owner: apache
     group: apache
     mode: 755
       - file
    - location: CodeDeploy/scripts/
      runas: root
    - location: CodeDeploy/scripts/
      runas: root
    - location: CodeDeploy/scripts/
runas: root

Here we can specify files, which we want to copy on server, permissions on any resources inside EC2 and like hooks, which will be running on EC2 machines, we specifying steps, BeforeInstall and AfterInstall. And that's it! We can specify any needed script which we want to see on our EC2 instances, and everything other will be done by CodeDeploy.

GitHub Hooks

And last thing, which I want to discuss today, it's GitHub Hooks.
The main point of GIT hooks, it's implementing some actions, after each commit on repository. And in our case, we are able to make CodeDeploy deployment on each hook on our repo. Few minutes of configuring, will give for us simple CD process, which we can use where we want on AWS.
To do this, go to your repository, click on settings and choose "Integrations & services".

And in provided fields, just specify your credentials to AWS.

Now, in each commit on this repo, CodeDeploy will implement changes on your EC2 hosts automatically.

Resources from GitHub : CodeDeploy

I wanna thanks everyone who watching my posts and I really hope, that this is information can be useful for you guys. Because I'm doing this posts, in format, like I'd wanted to get it. So, hope you enjoyed it. Thanks and bye bye :)


  1. can nitroglycerin act the same as viagra <a href="">enlarged prostate and viagra</a> kelly king viagra commercial actress

  2. viagra cheapest online <a href="">vegetal viagra</a> does medicare cover generic viagra

  3. levitra vs viagra effectiveness <a href="">viagra on craigslist</a> how much viagra should i take for fun

  4. generic viagra usa pharmacy <a href="">viagra with no prescription</a> about viagra

  5. viagra 75 mg <a href="">viagra works</a> is viagra government funded in america

  6. viagra free trial packs <a href="">using viagra to masturbate</a> viagra lsd

  7. need a prescription for viagra <a href="">how to get viagra without a prescription</a> when will viagra be available without a prescription

  8. how to buy viagra without prescription <a href="">do u need a prescription for viagra</a> do you need a prescription to buy viagra in canada

  9. ladies viagra <a href="">viagra vs stendra</a> female viagra pills workng

  10. viagra without a doctor prescription price <a href="">can i buy viagra without prescription</a> order generic viagra usa no prescription

  11. craigslist viagra <a href="">good rx for generic viagra</a> will taking more viagra give me a stronger erection

  12. can i get an online prescription for viagra <a href="">viagra no prescription</a> best non prescription viagra

  13. can you usr viagra with metoprolol <a href="">viagra for men walmart</a> do i need viagra

  14. red viagra 150 mg <a href="">dose of viagra</a> walmart viagra 100mg price

  15. viagra online with prescription <a href="">viagra online no prior prescription</a> prescription women viagra

  16. herbal viagra green box <a href="">is viagra safe</a> 300 mg viagra

  17. real viagra without prescription <a href="">cheap viagra pills without prescription</a> is viagra without a prescription in panama

  18. viagra for bodybuilding <a href="">homemade viagra aphrodisiac</a> drug interaction with viagra

  19. do you need a prescription for viagra <a href="">does viagra still require doctor's prescription?</a> non prescription viagra alternatives

  20. active ingredient in viagra <a href="">100 mg of viagra</a> can viagra be effective on dogs

  21. sildenafil stada rezeptfrei <a href="">cost of sildenafil vs viagra</a> can i take sildenafil daily

  22. epicatechin sildenafil <a href="">sildenafil citrate 50 mg price walmart</a> what is an effective dose of sildenafil

  23. purpose for sildenafil <a href="">how many sildenafil should i take</a> freds sildenafil

  24. how to stop viagra <a href="">pfizer viagra</a> can viagra cause ed

  25. sildenafil equivalent to viagra <a href="">does sildenafil work for females</a> sildenafil 20 mg macleods

  26. difference between sildenafil and sildenafil citrate <a href="">sildenafil generic usa</a> sildenafil cost coupon walgreens

  27. iv alprostadil v. sildenafil <a href="">sildenafil tab 50mg</a> ways to detect sildenafil

  28. generic name viagra <a href="">viagra no longer works</a> does viagra cause skin cancer

  29. comprar sildenafil generico <a href="">sildenafil 100mg amazon</a> are sildenafil and modafinil similar

  30. saferx viagra <a href="">generic viagra over counter</a> viagra for women side effects

  31. sildenafil natural alternatives <a href="">for hims sildenafil review</a> is viagra the same as sildenafil

  32. mhj instead of viagra <a href="">viagra not working for performance anxiety</a> no prescription generic viagra

  33. sildenafil generic shoprite <a href="">sildenafil 20 mg price cvs</a> sildenafil citrate tablets 100mg reviews

  34. viagra define <a href="">carvedilol and viagra</a> what if neither viagra or cialis work?

  35. sildenafil citrate 20 mg cost <a href="">how safe is sildenafil</a> sildenafil 50 mg no prescription

  36. 100 mg viagra walmart coupons <a href="">difference between viagra and cialis</a> viagra in "pee hole"

  37. can you take 200 mg of viagra <a href="">viagra discounts</a> pink viagra reviews

  38. what drugs should not be taken with viagra <a href="">how long does a viagra boner last</a> does viagra cause heartburn

  39. viagra pill for grocery stores <a href="">viagra main ingredient</a> viagra dosage equivalent to 20 mg levitra

  40. can low testosterone cause cialis not to work <a href="">is cialis better than levitra</a> how long until daily cialis is effective

  41. how long does cialis last after taking <a href="">order cialis from mexico</a> generic cialis prices

  42. liquid cialis shelf life <a href="">how much are cialis pills</a> cialis 5 mg enlarged prostate

  43. cialis india brands <a href="">donde comprar cialis generico</a> cialis percription

  44. uso de cialis <a href="">cialis cvs price</a> can you take 10mg cialis daily

  45. comparisons between viagra cialis and levitra <a href="">online consult cialis il</a> flomax and cialis

  46. how long will 10mg cialis last <a href="">cialis generic canadian pharmacy</a> cialis sideeffects

  47. how fast will cialis work <a href="">active ingredient in viagra and cialis</a> cialis two tubs

  48. does garlic affect cialis <a href="">can you take 2 cialis</a> cialis make you bigger

  49. cialis drug company <a href="">tamsulosin and cialis</a> can you break 20mg cialis in half

  50. genuine cialis for sale <a href="">cialis tv commercial</a> overnight cialis fedex

  51. cvs cialis coupon <a href="">cialis 5 mg</a> low cost cialis generic

  52. taking cialis 5 mg twice a day cause <a href="">alternative to viagra or cialis</a> cialis marketing

  53. cheap cialis online uk <a href="">when will generic cialis be available over the counter</a> want to buy cialis online

  54. best place to order cialis online <a href="">how long does 20mg cialis last</a> alldaychemist cialis

  55. which is xname viagra or cialis <a href="">natural cialis supplement</a> cost of viagra and cialis

  56. cbd oil legal in all 50 states emblem <a href="">does walgreens sell cbd oil</a> is cbd oil legit

  57. cbd oil distillery <a href="">vape stores that carry cbd oil in maryland</a> can cbd oil cause a positive drug test

  58. fda approved cbd oil <a href="">how to take broad spectrum cbd oil 500 mg</a> cbd oil cvs pharmacy

  59. cbd oil sold near me <a href="">buying cbd oil</a> cbd oil vs hemp oil for pain

  60. reputable cbd oil dropshippers <a href="">making soap with cbd oil with recipes</a> water based cbd oil

  61. cbd oil topically for pain <a href="">cbd oil for pain</a> cbd oil pain relief

  62. cbd oil whole foods market <a href="">does cbd oil cure cancer</a> how much thc in cbd oil

  63. buy cbd oil tampa <a href="">start a cbd oil business</a> hemp cbd oil med 7

  64. is cbd oil from the stalk <a href="">health benefits of cbd oil for cats</a> cbd oil fibromyalgia dosing

  65. cbd oil cheap <a href="">cbd oil effects on thc</a> will cbd oil

  66. can cbd oil trigger an asthma attack <a href="">cbd oil and pain</a> where is cbd oil legal

  67. cbd oil spray total plant <a href="">how to take cbd oil for anxiety</a> cbd oil manufactured near cleveland oh

  68. that's natural cbd oil <a href="">walgreens cbd oil price</a> cbd oil cause headaches

  69. cbd oil and psoriasis <a href="">cbd kush vape oil in oregon</a> cbd oil is it an anti inflammatory

  70. cbd oil treatment for copd <a href="">is hemp seed oil and cbd the same thing</a> usa premium oil cbd infused 5000 series

  71. fort collins co cbd oil <a href="">suthe cbd oil</a> making cbd oil at home

  72. cbd oil pills <a href="">california naturals cbd oil</a> can you take fish oil with cbd oil

  73. cbd oil idaho <a href="">cbd oil medford oregon</a> cbd oil cost

  74. jade ultra cbd oil <a href="">can cbd oil make anxiety worse</a> bluebird cbd oil for sale

  75. free cbd oil <a href="">cbd oil maine organic</a> how does cbd oil work for dry skin

  76. cbd oil for dogs with severe anxiety <a href="">dosage of cbd oil for degenerative disc disease</a> cbd oil munchies

  77. cbd oil dosages for diabetes type 2 <a href="">any cbd oil scams</a> which cbd oil florida

  78. cbd oil box mods <a href="">can cbd oil cause itching</a> tested cbd oil

  79. pg free cbd vape oil <a href="">full spectrum cbd oil benefits</a> free cbd oil trial

  80. cbd oil fibromyalgia <a href="">veterinarians using cbd oil</a> thc free cbd oil brands

  81. cbd oil for dogs with voice box parapalegia <a href="">hemp cbd oil</a> cbd oil for parkinson

  82. best cbd oil for dogs 2019 <a href="">iowa cbd oil</a> cbd body oil

  83. does cbd oil build up in your system <a href="">cbd oil for kids with adhd and autism</a> is vaping cbd oil dangerous

  84. is cbd oil legal in arizona 2018 <a href="">cbd and mct oil</a> is cbd oil legal in ohio 2019

  85. cbd oil helps nerv damage <a href="">mary's medicinals cbd oil</a> cbd oil blood pressure

  86. internet <a href="">Check Out</a> get more information

  87. take a look at the site here <a href="">great site</a> see this

  88. use this link <a href="">navigate to these guys</a> find this

  89. click for more info <a href="">index</a> our site

  90. Recommended Site <a href="">about his</a> look at these guys

  91. right here <a href="">sneak a peek at this web-site.</a> find more information

  92. more bonuses <a href="">extra resources</a> news

  93. why not look here <a href="">my company</a> Website

  94. more <a href="">click over here now</a> hop over to these guys

  95. cool training <a href="">Resources</a> how much is yours worth?

  96. why not try here <a href="">in the know</a> weblink

  97. Website <a href="">news</a> advice

  98. go now <a href="">read more</a> blog here

  99. look at this website <a href="">anonymous</a> like it

  100. click here to read <a href="">click this link now</a> see this site

  101. visit your url <a href="">website</a> why not look here

  102. visit these guys <a href="">you could check here</a> Recommended Site

  103. webpage <a href="">watch this video</a> More hints

  104. try this <a href="">official source</a> Recommended Site

  105. Bonuses <a href="">This Site</a> get redirected here

  106. look at here now <a href="">here are the findings</a> helpful hints

  107. take a look at the site here <a href="">see it here</a> you can try here

  108. helpful site <a href="">have a peek at this web-site</a> find

  109. my review here <a href="">try this web-site</a> Discover More

  110. discover this <a href="">find out here now</a> click this link

  111. pop over to this web-site <a href="">why not try here</a> here.

  112. i loved this <a href="">Continue</a> visit this page

  113. check out this site <a href="">on Bing</a> over at this website

  114. click to find out more <a href="">click for more</a> great post to read

  115. look what i found <a href="">click here!</a> take a look at the site here

  116. in the know <a href="">Our site</a> go to these guys

  117. check my reference <a href="">webpage</a> go now

  118. visit this website <a href="">how you can help</a> More about the author

  119. my company <a href="">helpful site</a> useful reference

  120. article <a href="">i thought about this</a> this contact form

  121. try this out <a href="">sneak a peek at this site</a> view it now

  122. browse around this website <a href="">have a peek here</a> article

  123. can you buy viagra with a perscripen <a href="">how much does viagra cost at cvs</a> viagra 1996 x guest book

  124. does insurance cover cbd oil <a href="">cbd oil reviews 2019</a> charlotte's web cbd oil virginia law onyoutube

  125. how much does viagra cost in mexico <a href="">viagra online roman</a> what happens when women take viagra

  126. the best full spectrum cbd oil <a href="">cbd oil upset stomach</a> can cbd oil help yeast infections

  127. aphrodisiac herbal drink thats like viagra 6 pack <a href="">price for viagra</a> does viagra increase sensitivity

  128. do you stay hard after coming on viagra <a href="">federal patent law protection viagra revatio</a> fda warning viagra

  129. cbd oil dreams <a href="">how to make cbd oil with olive oil</a> cbd oil interactions with medications list

  130. cbd oil for paralises <a href="">cbd vape oil side effects</a> harvest cbd oil

  131. how fast does cbd oil work <a href="">can cbd oil stop carpal tunnel pain and tingling</a> side effects cbd hemp oil

  132. horse viagra <a href="">viagra erections after photos of nudes</a> african superman viagra

  133. cbd oil treat depression <a href="">cbd oil for dogs hip pain</a> original brand 420 cbd oil sublingual

  134. can viagra and cialis be taken together <a href="">200 milligram viagra</a> can you take viagra and opiods at the same time

  135. do viagra pills have an expiration date <a href="">viagra drug class</a> does viagra pills expire

  136. cbd oil for sale wholesale <a href="">us fda website relating to cbd oil</a> cbd oil legal in north carolina

  137. viagra bill <a href="">viagra competition</a> about viagra

  138. hempworx cbd oil review <a href="">cbd oil face cream</a> just cbd oil

  139. can you cum alot when you take viagra <a href="">natural replacement for viagra</a> viagra samples cvs

  140. viagra venta libre <a href="">does viagra work with alcohol</a> viagra femdom

  141. are hemp oil and cbd oil the same <a href="">does cbd oil get u high</a> is hemp seed oil equal to cbd oil

  142. cbd oil independent review <a href="">hale cbd oil</a> will cbd oil show on a drug test

  143. cialis faq <a href="">cialis vietnam</a> cialis and alcohol use

  144. is there generic cialis <a href="">cialis class</a> comparison of viagra and cialis

  145. cialis working show <a href="">when does cialis lose its patent</a> cialis patent expiring

  146. cbd oil for alcohol withdrawal <a href="">dosage for cbd oil for cancer</a> best cheap cbd oil

  147. buy viagra cialis levitra online <a href="">where to buy cialis without prescription</a> cialis and molly

  148. is cbd oil a scam <a href="">cbd oil tyler texas</a> xname oklahoma cbd oil

  149. Leave a Comment