Search

Donnerstag, 28. November 2019

Docker deployment into Amazon AWS

Amazon AWS

Date when this services were used: 24.12.2019

Hi folks, this time i will blog about my experience deploying my Oracle ADF application into the Amazon AWS Kubernetes.
It's good to know how big the Amazon infrastructure really is , so here is map for current date 24.12.2019 , for more information look up on amazon infrastructure site

As you can see there lots of servers which Amazon provide to their clients. 

Let's do then hands on experience:
Read this tutorial about how to deploy docker containers in AWS
Then the first thing which you should do is to create a repository ECR , read the tutorial how to setup ECR.

Further more read the tutorial get started with ECR.

1.   How much does it costs to run the small webapp in the cloud?



The first 12 month its complete free!  WATCH OUT ITS FREE BUT NOT FOR ANY TYPE OF INSTANCE ,  if you select for EC2 other resources and not the micro instance you will be charged for using such powerful instance!



This then FREE!!!



Notice for my case i wasn't able to run on micro stable, thats why i picked medium machine!

Here is my bill for one month of Kubernetes usage in AWS i did run my site on different instances !


Selecting a plan wont change things a lot , but maybe if you serious enough to go with cloud AWS you have following options:



But you need to set up a budget in AWS and make sure that no wrong bill will be generated! 
Setting of the budget was pretty easy like for my taste, so there would not be any setup hassle in this regards.


2.  How fast your app can be deployed into the  cloud?

First, you need to create a repository!
1. Go to ECR and simply generate your repo , don’t forget to choose the region where you want to store your docker stuff , in my case it was Europe, in your case it will be other region, the experience can be different.
After that you need to install Amazon command line utilities shortcut as cli to your local workstation, as I said in my previous blogs I use RHEL , so lets install and go trough this AWS tutorial  in order to be able to push docker container into AWS registry!

“You need a red card for opening this door”  some random Doom guy......

For further steps your need to obtain your keys!

Tutorial how to get access to keys!!!

Then configure your aws tools on your local machine, oh gosh and I thought that it will be automatic  like in google cloud lol!

Here is example how to configure your AWS CLI

In one of the steps there is mentioned info for retrieving docker login , so do docker login first! Only then you can push it to registry !
now go back to the ECR  in aws cloud where you did created your repo and click on View push commands, there you will see commands where you actually can see how to push your docker image to aws cloud private registry!

Personally I think AWS as cloud provider should put it in bold and underlined and mentioned that you need after installing CLI on your local machine additionally need to configure aws tools, it was not obvious to me, but still I was able to push my docker container to the repo and I happy about it!
Finally , are you read to deploy it into your AWS EKS cluster ? 


Me too , well then do it!  Click on EKS 
Specify cluster name and click next
It takes in some case more the 15 minutes to spin up the cluster, so do something else during this process.


Oh no , I did not specified the IAM role, well go to the IAM roles, you need EKS role and others ECS, because your Kubernetes will be managing your clusters, now was this so hard ?


Let’s see! Not only you need EKS role, but you need Elastic Container Service
Elastic Container Service Autoscale, how I know about this?  well , if you create your new kubernetes cluster AWS need IAM roles , and without this minimum set up it would not allow to create a Kubernetes cluster.
–Then you need to specify your Subnets, AWS need minimum 2 , so there is no other minimum choice that to use only 2. Don’t  forget to activate your security groups too. Logging, well for my small site I don’t need that, but if you have big project well you should definitely do that.

Then you have tags , so basically, one last thing is to deploy from aws registry the docker container into the EKS. It take a while to spin up those pods …..

Now to the fun part where we deploy our container to Kubernetes !!!

Read this tutorial about ECR on EKS

Click on add node group, oh no I forgot that I need IAM Role for create node!!!!!
You need EC2 role !!!! Go back to IAM role and assign it in IAM!

There you need AdministratorAccess (Provides full access to AWS services and resources)


There actually even more roles, lets apply it! EKS – Nodegroup and read again the tutorial 

Well from this point I was puzzled what I need in order to create my worker nods? Which roles I need to create and assign to IAM ?


If you create new nodes aws require that you specify the role for your node!

Ok I figure it out, got to your iam click on role EKS and assign as showed in the following youtube tutorial ! 

It should look like in picture below (after you specified the IAM role in your node creating view! )


In my case i wasn't able to run my site on micro instance but rather on small instance, well then i post here the bill which amazon will charge for running small instance , interesting.

Now lets do the other stuff!

We need to deploy the container into Kubernetes cluster!!!

Read this tutorial how to install web ui for Kubernetes, trough which later we able to deploy the container, there is no obvious need to write yml file like in my case!

One thing to mention that your running the Kubernetes UI via Proxy on your machine, but it's better experience then doing trough yml files via console, because then you don’t need to create deployment yml files at all, i hate doing that manually , do you?!

During the deployment via kubernetes web ui there would be a questions about
Port and target port, I was quite puzzled what it means but, you need to set up port for incoming request and the target port where your server or app configured to response in your docker container!

Its actually pretty easy, you start up your kubernetes web view, then there you will find deployments page , where you need to specify the name of your webapp, url to container image and as i already mentioned the ports (here i do reference for external type of deployment)

Here is a list of useful tutorials about Kubernetes web view, please notice the links below  on kubernetes page will be after some time unavailable so i recommend to save them as pdf files and store in your storage for further reference!


FINALLY HOW TO GET THE PUBLIC ADDRESS: you need to run this command on your local machine , where your kubernetes aws configured: kubectl describe services

3.  How easy the configuration for the deployment in the cloud?

First, you need to be registered in aws, if you use amazon already, use another email address to get the full benefits as new aws user!

After registration you will see the select support plan page, well obviously I select a free plan ;) Then you see following page with 10 Mins Tutorials, which i honestly skipped 

Then you see the aws services !


Most of time i spent understanding how IAM roles apply to the whole Kubernetes setup, and then just setting the stuff up in IAM.

Then there additional maintenance , i executed on both my instances the update command eg sudo yum update, make sure that all of your instance working, i was amazed when i connected to all of my instances and the were in freeze state, then reboot helps.

4. How can you scale resources in the cloud for your application?
When you did configured your local kubernetes cli on your local machine you can directly work with aws , but like for my taste its too much work , using web ui is actually better.

5. Which additional services provide the cloud provider for extending your app?
EC2 and others, they exist but you need always think about IAM , without proper IAM configuration it would not work.

6. How easy it would be to move the webapp to another cloud provider if you find better prices, which other cloud provider offers you?
If you have your stuff only in Docker container, then it would be pretty easy, if you rely on the Amazon cloud provider services, then it probably would not be easy and further time need to be invested to figure it out if another Cloud provider can offer same services.

7. What kind of tools you need to know to be able to deploy into the cloud?
As i mentioned early you need to use the aws cli and the kubernetes kubectl tools, the web ui of AWS is powerful too, but in my case i spent some time configuring the Kubernetes web ui, so that i can deploy my docker container in the simplest way possible.

8. Is there any additional maintenance for you app?
Maybe if you use Amazon Dynamo DB or other services , there would be actual need for maintenance, but in my case once deployed my Docker container it works pretty well.

9.  What kind of tools does cloud provider give you to analyze the performance of your app?
For Kubernetes you need to install web ui , to get a clue how well its running, luckily Amazon provide enough information to run Kubernetes Web UI trough proxy on your machine. Sure it would be better if Amazon would provided default web tools about the state of your kubernetes cluster, but i don't think that's a big no go.

10. How secure the cloud environment where you  running your app?
I think the security is pretty tight, because most of your time, your will spent with working with IAM roles  and understanding them is a must for running your stuff in production.

Conclusion

Amazon AWS is another great Cloud provider i must say even with given short amount of time i was very productive and more then able to deploy my webapp to AWS Cloud.
There maybe some issues with Amazon AWS tooling, i don't like to write yml and work trough console only, i love doing the setup through web ui's, but maybe some senior type AWS cloud engineers would disagree with me and thats ok , speed over quality or quality over speed will be always a challenge in IT field.
Overall my experience with Amazon AWS was great and once again Amazon is one of major leaders in the Cloud services, so definitely try it out for your business!
Here is my page currently offline on aws , i hope when you access it , it will work , if not then just write me the comment or send a message to my twitter 

Interested in more reviews?
Lookup following comparison table of other cloud providers.

Kommentare:

  1. Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time
    Kubernetes online training
    Kubernetes online course

    AntwortenLöschen
    Antworten
    1. I allowed your post , but try not to advertise to much. People i dont know sneha trainings and sneha personally so be warned.

      Löschen
  2. Antworten
    1. I allowed your post , but try not to advertise to much. People i dont know dhinesh trainings and dhinesh so be warned.

      Löschen

All comments are pre moderated be polite and respectful!

Blog-Archiv

Blog readers favorites