How to deploy many applications with subdomains in AWS? Which config should I use? - amazon-web-services

I'm new to AWS and deployment. Here's my doubt.
I've a domain, let's say www.company.com. I've 3 apps to deploy,
NodeJS Backend (api.clientName.company.com)
React Marketplace (clientName.company.com)
React Admin Panel (admin.clientName.company.com)
So I'll customize as per clients requirements and deploy like clientName.company.com.
What config should I use for many clients? Now I got 5 more new clients. Can I create only one EC2 instance and manage all clients apps together? Also can I migrate my domains to route53 so that I can create unlimited subdomains?
Can anyone explain my doubts.

Yes, you can manage multiple applications on single EC2 instance, but make sure the instance size is large enough to withstand the traffic.
You can achieve this by using Laravel Forge in which you can deploy Laravel and simple PHP Applications as well. It just makes things easier to manage.
If you not comfortable using Laravel Forge you can use Filezilla too.
It is better if you migrate domains into Route53 as it will be easier to manage and everything will be in one place.
You can create the subdomains as you like and map it to the EC2 instances Elastic IP, make sure you attach an EIP so that the IP address does not change after a reboot.

Related

Need Assistance Hosting on AWS

So I’ve just finished working on my first big personal project, bought a domain name, created an AWS account, watched a lot of AWS tutorials, but I still can’t figure out how to host my web app on AWS. The whole AWS thing is a mystery to me. No tutorial online seems to teach exactly what I need.
What I’m trying to do is this:
Host my dynamic web app on a secure https connection.
Host the web app using the personalized domain name I purchased.
Link my git repo to AWS so I can easily commit and push changes when needed.
Please assist me by pointing me to a resource that can help me achieve the above 3 tasks.
For now, the web app is still hosted on Heroku’s free service; feel free to take a look at the application, and provide some feedback if you can.
Link to web app:my web app
You mentioned - The web app is still hosted on Heroku’s free service
So, if you want the same thing in AWS, use Elastic Beanstalk.
First Question: How to host my web app on AWS?
There can be multiple options to host your web app:-
S3 Bucket to host your website. How to Host in S3
Elastic Beanstalk. Link
ECS - using containers
Single EC2 Server to host your website.
EKS - Kubernetes
By the way, there are many couples of things which you need to take care of before starting.
Second Question, Host the web app using the personalized domain name I purchased.
If you have used S3, the hosted URL will be in HTTP and you can create a route entry in your purchased domain settings. If it is AWS, create a new record in Route53.
If you host your website on EC2, you will get Public IP Address. Make a route entry with that Public IP.
If you have used ECS or EKS, you might require to use the Load Balancer and then you will have the Load Balancer DNS. Make a route entry with your Load Balancer DNS. Then again question will arise which kind of Load Balancer you want to use. [Like Application, Classic or Network Load Balancer]
If you use Elastic Beanstalk. It's a managed service, when you host you will directly get an endpoint. Make a route entry with that endpoint.
Third, Link my git repo to AWS so I can easily commit and push changes when needed.
For this, you have to use Code Build and connect Github as a Source while creating Code Build Project. Link
For CI-CD, there are multiple things again.
As Heroku’s is a PaaS, which provides you the platform and but when it comes to AWS, it is an IaaS. So you get the infrastructure and when you get the provisioned infrastructure, there are so many things which you need to take care of like you have to think like an Architect. Prepare the architecture and then proceed. It requires knowledge of other things also networking, security etc.
To answer your question, the best way to host a web app in AWS is Elastic Beanstalk
But what is AWS Elastic Beanstalk and what does it do?
AWS Elastic Beanstalk encompasses processes and operations connected with the deployment of web apps into the cloud environment, as well as their scaling.
Elastic Beanstalk automates the deployment by putting forward the required capacity, balancing the load, autoscaling, and monitoring software efficiency and performance. All that is left for a developer to do is to apply the code. In these conditions, the application owner has overall control over the capacity that AWS provides for the software and can access it at any time.
So this is the best way to deploy the app and let’s follow the steps.
Open the Elastic Beanstalk console and find the management page of your environment.
Select “Upload and Deploy”.
Select “Choose File” and choose the source bundle with the dialog box.
Deploy and select the URL to open the new website.
You can use CodeDeploy to connect your Github and deploy your code
Conclusion
I have taken a simplistic approach and told you exactly what you need to do the required task without going into the hus and fuss of AWS. Saying that there is still a lot that can be done to bring the real value of your application in terms of balancing the load, scaling or improving the performance.

Information on how to public a website

It's the first time I will be publishing a website and have no idea on how this works.
Here's a few details on what I'm trying to achieve.
I have created a sample website in nodejs and uploaded it to docker (two containers, one for nodejs and the other one for mongodb database)
Now I would like to upload this on aws but not really sure where to start and what I need to know.
In addition, I want a domain, the price is quite high for the .com domain I am looking.
My questions are as follow:
If I buy a domain, how do I hookup the domain so it's routed to the aws server where I have my website deign, logic and database, how exactly does this work?
What's the best way to buy a domain? does anyone have any experience and advice on the best approach?
Thanks
You'll need to setup your vm and begin hosting your site w/ the custom ec2 URL, then configure the Amazon dns server (Route 53) with your domain to point at the correct vm.
Step 1
Get an ec2 box running (whatever size you think you'll need for traffic/storage). When you go through the portal, you'll need to Authorize Inbound Traffic.
Now you can sign into your ec2 vm, download any dependencies you'll need (npm for instance) and run your site just like you would locally in a terminal. Here's a sample that may help if you have trouble.
Step 2
You now need to the dns servers to translate the domain you owned into the ip of your ec2 vm. You can use the Route 53 service to do this.
Alternatives
You can also use Azure's App Services to do this. It's a cloud app hosting service that's meant to help you get your app on the cloud and scale it without much trouble. Here's a Node.js Sample.
...And here's the instructions on how to setup a custom domain.

Sails app with multiple instances on AWS - Redis/Elasticache/ALB

I'm building a Sails app that is using socket.io and see that Sails offers a method for using multiple servers via redis:
http://sailsjs.org/documentation/concepts/realtime/multi-server-environments
Since I will be placing the app on AWS, preferably with ELB (elastic load balancer) and autoscale group with multiple EC2 instances was wondering how I can handle so it doesn't need a separate redis instance?
Maybe we can use AWS Elasticache? If so - how would this be done?
Now that AWS has released the new ALB application load balancer which has websockets, could this be used to help simplify things?
Thanks in advance
Updates for use-cases in application
Allow end-user to update data dynamically from their own dashboard
and display analytics/stats in real-time to an administrator
Application status' to change based on specific timings eg. at a
given start date/time the app allows users to update data.
Regarding your first question, you don't want to run Redis on the same servers that Sails is running on, especially if you are using AutoScaling. The Redis server needs to be a separate server that won't disappear if your environment experiences a "scale-in" event. So Redis is going to have to be on a separate "server" somewhere.
ElastiCache is just separate EC2 instances, running Redis, where AWS handles most of the management for you to the point that you can't even SSH into the instance. It's similar to how RDS works. ElastiCache will certainly work for your scenario. You might also want to look at the third-party service RedisLabs which also manages Redis instances on AWS for you.
Regarding your second question, an Application Load Balancer will have no bearing on your Redis usage. It will however bring actual support for WebSockets which it sounds like you are using. So yes, you should be using an ALB instead of an ELB.

Proper loadbalancing EC2 instances in AWS

I am pretty new to AWS and want to build a simple example auto scaling wordpress application with EC2 instances.
I understand how to create a loadbalancer, how to create bitnami wordpress ec2 instances and a autoscaling group and get all running but here is what i dont get and cannot find in any documentation:
Every EC2 Wordpress instance that i create has obviously its own wordpress data and database. They are not synchronized. So if the Load Balancer sends the Traffic to EC2 A the user will see an other Appplication set then EC2 B.
How do people set this up / solve this to be able to add unlimited ressources which hold the same application / work for the same Application.
Running Wordpress behind a Load Balancer (ELB) is a little bit tricky as by default Wordpress is storing data on volumes of the EC2 instances.
A possible solution:
Use RDS to launch a managed MySQL database and connect Wordpress to it.
Outsource the user uploads to S3 with Wordpress plugins amazon-web-services and amazon-s3-and-cloudfront.
But beware: you need to disable auto-update, the Wordpress theme gallery, ... and everything else that is changing files on a single EC2 instance.
I've written a blog post covering that topic: https://cloudonaut.io/wordpress-on-aws-you-are-holding-it-wrong/ some time ago.
Alternatives:
Use a distributed file system (e.g. GlusterFS) to store all Wordpress files.
Use CloudFront (CDN) to cache incoming requests and run everything on a single EC2 instance.
There is official best practices and blog post. Check here
https://blogs.aws.amazon.com/php/post/Tx1TRYG42UP11ET/WordPress-on-AWS-Whitepapers

Deploy and manage WebApp with AWS services

I’m noob with AWS services, I develop web application with Ruby on Rails, so, I’ll like to know what could be the best way or the right one to deploy and manage web application with AWS.
Right now there are bunch of services of AWS for handle web apps, but I’m not sure which service to use, OpsWork, EC2 (setup the entire server), Elastic Beanstalk or EC2 Containers and so on…
Well, I have 3 small apps from diferentes clients and I’m looking the right way to have them on one instance or couples of instances, right know i’m with OpsWorks, I have 3 stack, one for each web app, I want to know if I can deploy and manage those apps in one stack and 2 instance of OpsWorks or there are better way or other services as IaaS or PaaS solutions?. So i’m looking for advise or orientation for use AWS service for those kind of thing.
This question is rather vague and the answer depends on the needs of your app, but I'll give my 2 cents regardless. I have several rails apps hosted on EC2 instances running Ubuntu, NGINX, and Phusion Passenger. The apps that receive a decent amount of traffic and require consistent performance/availability are cloned across multiple EC2 instances (in multiple zones) and have traffic managed by Elastic Load Balancers (ELBs). The app databases are served through amazon's RDS services. Domain registration and nameservers are set up through AWS Route 53. Static assets are served from AWS S3.
This type of architecture certainly has a price tag on it and isn't the only way to do it. My experience has been that all of my older Rails apps have survived over a year with 100% uptime and rarely have moments of slowness been the fault of AWS as opposed to my own code or 3rd-party software.
Hope this helps; feel free to ask questions.