Information on how to public a website - amazon-web-services

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.

Related

How do I setup SSL for a php single instance on AWS Elastic Beanstalk?

This is my first time setting up a dynamic website, so bare with me. My goal is to have SSL/https working on my php single instance aws Elastic beanstalk web app.
I already know that with a load balancer SSL is easy to set up and ACM certificates only work with load balancer.
I want single instance since it is cheaper. My project is small, don't expect a lot of traffic at most 1 user per day.
... back to problem, I did some research and came across this link, which is a "how to" from amazon:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-php.html
The problem I'm running into is the part where I'm suppose to put my "certificate contents here".
From research what goes here is a SSL certificate from a third party. When I purchased my domain from namecheap , I also purchased PostivieSSL. Now where I'm confused is how to create this "cerificate contents". I found this link on namecheap:
https://www.namecheap.com/support/knowledgebase/article.aspx/9446/14/generating-csr-on-apache-opensslmodsslnginx-heroku/
I know that I have to generate a CSR through SSH with commands ,where they will ask info about my site which is needed to make the request and get the certificate. It says I have to do this where I'm hosting my website. My question is how do I do this in elastic beanstalk? or is there another way to do this or am I understanding wrong. I'm a bit lost here
I've spent 2 days researching but cant find how to do this. I've found some people linking GitHub repositories doing this in some other similar questions but they don't seem to help me understand how to do this.
I was more or less in your shoes, but with the Java app instead of PHP. The way I see it, you have got three broad tasks to solve.
Generate proper certificate. You can either go for the one you already have from PositiveSSL or generate a free one for test purposes with Let's Encrypt and certbot (this might give you more control and understanding over what (sub)domain you're using it for). The end result is a set of certificate and key for the desired domain.
Make sure the certificate and key are on the Elastic Beanstalk instance in question and are being picked up by your web server. For this you need to properly package your app before deploying it, paying attention to the paths and the AWS docs for the single instance which you mentioned. Paste your certificate data in .ebextensions/https-instance.config, and it will be deployed as files under specified paths. Once you're done with the whole process later on, consider sourcing private certs and keys from your S3, never commit private data to version control.
Make sure the HTTPS traffic flows through. For this you'll need to make sure that your Elastic Beanstalk VPC security group has an inbound rule for port 443 (also covered in the AWS docs).

How to deploy many applications with subdomains in AWS? Which config should I use?

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.

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.

how to add a website to aws ec2 instance, no target

I've a nice little ec2 instance, I've logged in the console, updated the YUM, started the httpd, but the IP doesn't work in the browser.
my httpd is up on chkconfig: httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Thought it would be as listed on my connect from public DNS, same as I connect to console through. I've used the S3 server into the properties on the instance and enabled static website hosting, just to test it before using PHP. Even created a like bucket, trying to use my domain name from the Route 53, but the Route 53 also shows "No Targets Available" in the S3 (or any other).
Alrighty, found it. Was a security issue, but here is the process, in two quick url's.
Tutorial: Installing a LAMP Web Server on Amazon Linux
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html?shortFooter=true
But it says if it doesn't work, check the security groups, and a couple of clicks later you're looking at this.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html?shortFooter=true
Go into the security group settings and add http from pull down and it's done.
Also, the second part where there isn't a target, be sure and associate the elasticIP (created in the AWS services console) and sure enough a web server is up and running. Once you've the elasticIP address simply add it to the route 53 rule set(s).

Setting up an Amazon Server with Go Daddy

I am trying to set up an Amazon Server to host a dynamic website I'm currently creating. I have the domain bought on GoDaddy.com, and I believe that what I've done so far has linked the domain to my Amazon account.
I followed this tutorial : http://www.mycowsworld.com/blog/2013/07/29/setting-up-a-godaddy-domain-name-with-amazon-web-services/
In short, this walked me through setting up and Amazon S3 (Simple Storage Service) and Amazon Route 53. I then configured the DNS Servers, and my website now launches properly on the domain.
I'm not sure on the next step from here, but I would like to set up:
-A database server
-Anything else that might be necessary to run a dynamic website.
I am very new to hosting websites, and semi-new to web development in general, so the more in depth the better.
Thanks a lot
You have two options on AWS. Run an EC2 server and setup your application or continue to use the AWS managed services like S3.
Flask apps can be hosted on Elastic Beanstalk and
your database can be hosted on RDS (Relational Database Service). Then the two can be integrated.
Otherwise, spin up your own t2.micro instance in EC2. Log in via ssh and set up the database server and application like you have locally. This server could also host the (currently S3 hosted) static files too.
I have no idea what your requirements are, personally I would start with setting up the EC2 instance and go from there as integrating AWS services is without knowing what you need is probably not the easiest first step.
Heroku might be another option. They host their services on AWS and give you an end to end solution for deploying and running your python code without getting your hands dirty setting up servers.