I am new to AWS, i am already having a godaddy VPS server, but my application is very slow when i hosted it in goDaddy VPS.
So i migrated to AWS, now my application works very fast, but some times the EC2 instance is getting failed and it automatically restarts after some times. since my application is basically an on-demand service app, these instance failure causes me to lose some conversations. So i heard about load balancing service from amazon, if one instance failed automatically turns the traffic to other instance.
I have used ubuntu 16.04 instance with vestaCP to host my application in AWS EC2. So is it possible to use the storage of my current-master EC2 instance with a new-alternative instance? so that same datas and database will be used by both the EC2 instances.
Might my question looks funny, but i need to know whether its possible or not? if possible any tutorials! if its not possible what kind of services need to use AWS load balancer to handle high traffic and instance failure.
Thanks
If you are migrating from a more conventional hosting to a cloud provider but you don't adopt a cloud architecture, you are missing out many of the benefits of the cloud.
In general, for a highly available, highly scalable web application, having shared data locally is an anti-pattern.
A modern web application would separate state (storage) from processing. Ideally your instance would hold only configuration and temporary data. For the database, assuming you are using a relational database, you would start a RDS instance. For the files, if they are mainly things like images and static content, you would probably use The Simple Storage Service, S3.
Your EC2 instance would connect to the RDS database and S3. Since the data is not local to the instance anymore, you can easily have multiple instances all using the same storage.
Your EC2 instances could be configured with autoscaling, so AWS would automatically add or remove instances responding to the real traffic you are seeing.
If you have complex storage needs and S3 is not enough for the file layer (and for most applications S3 should suffice), you can take a look at the Elastic File System.
Yes, It is achievable through ELB of AWS. But you have mention for separate requirement of ec2 instance, there is no need of such as AWS ELB manages all this for you.
Note: Always keep your database on another instance like 'AWS RDS' featuring data backup, rollback and if one instance fails then another instance have access to database. Same for files should be stored on 'AWS S3' then only you can achieve load balancing.
For more information.
link
Related
I recently realised my NEXT JS project I deployed on AWS Amplify uses Lambda but I need to deploy it on EC2. Is this possible at all?
I'm new to this whole thing so excuse the ignorance but for certain reasons I need to use EC2?
Is that possible?
Thanks
AWS EC2 is a service that provides all the compute, storage, and networking needs you may have for any application you want to develop. From its site:
Amazon EC2 offers the broadest and deepest compute platform with a choice of processor, storage, networking, operating system, and purchase model.
Source
Basically, you can create any number of virtual machines, connected among themselves and to the Internet however you like; and use any data persistence strategy.
There are many things to unpack when using EC2, but to start, I would suggest that you learn how to set up an EC2 instance using the default VPC that comes with your account. Be sure to configure the instance to have a public IP so you can access it through the Internet. Once inside, you can deploy your application however you like and access it through your public IP.
Before moving on, trying to decide why you need your app to run on EC2, Lambda is a SaaS (Software as a Service) product, meaning that all of the service provider's infrastructures are managed. On the other hand, EC2 is an IaaS product (Infrastructure as a Service) which means that you have to handle most of the infrastructure.
Which is the best strategy to deploy .net Web application on AWS?
1. On EC2 instance where on single instance deploy both application and MS sql database.
2. On elastic beanstalk where the application is deployed on EC2 instance and database in RDS.
OR any other strategy.
What do you think?
This depends on your use case and budget. Running on the single instance is affordable but will be a single point of failure, and in case your instance goes down, your entire web app is gone. On top of that, any updates can be a nightmare. This is only ideal for development environments.
If you deploy via Beanstalk with external database, it will be expensive but it will be exponentially more fault tolerant. If your EC2 instance goes down, it will get replaced automatically (though you can achieve this even when using single instance. For prod, you must decouple your database instance from your environment, so you can run a database instance in Amazon RDS and configure your application to connect to it on launch. This enables you to connect multiple environments to a database, terminate an environment without affecting the database, and perform seamless updates with blue-green deployments.
Also, the 2nd option will be pretty convenient. All you have to do it give EB your application source bundle and it will do all the legwork. You can read more about EB and RDS setup here.
I' m a little bit confused with caching.
So let's say i want to build a simple chat website with users login/register and photo uploading.
I plan to save uploaded files in amazon s3.
user data in dynamodb.
So which type of data should i put in elasticache to improve my website performances ?
Another question, if i use elastic beanstalk, should i need to use elastic load balancing along ?
I read that Elastic beanstalk was an automated version of EC2 so no need to take care about manual processes, so is this involving ELB ?
Thanks for helping
I think you are confused about terms. The technologies you are talking about are totally different things.
Elasticache is a managed Memcached/Redis solution. You use it for caching purposes, not for persistent data
Elastic Load Balancing is a managed Load Balancing solution. Like Haproxy. If you want to leverage high availability and scalability features of AWS you need it. You create an autoscaling group which spawns or kills EC2 instances whenever it is needed (according to rules you will set up) and autoscaling groups attaches or detaches EC2 instances from ELB. If you install your application only to one instance you do not have to worry about it, but if you are doing like that you're doing wrong, it is not how AWS works. Just go and use a cheaper and easier VPS company.
Elastic Beanstalk is a wrapper service. It is intented to abstract the complexity of all these EC2 stuff. It is like Heroku or Google App Engine, you give it your application file (or docker image) and it just installs everything for you.
If you are new at AWS I'd recommend you to start with Elastic Beanstalk, understand how it works under the hood and which type of resources will create for you. Once you learn the basics, you can create your own stack and customize it more. But Elasticbeanstalk is also production-ready product. You can trust in it.
I need to set up a public-facing web server and a private database server in AWS. So that I can allow higher availability - is it okay that I have my public subnet in one AZ hosting my web server and another (so duplicate) WebServer in a different AZ? The same principle would apply to database server configuration. Essentially, Zone-A would host WebServer, Zone-B would host WebServer-copy. Zone-B would host DatabaseServer, Zone-A would host Database-copy. Is this architecture a good practice?
If yes, does this configuration mean site files and database files are duplicated on each AZ?
Yes, that's basically how you setup high availability on AWS. I would recommend using RDS for the database which will manage multi-az deployments for you automatically. Managing the data replication manually can be a real challenge.
I would also recommend looking into Elastic Beanstalk which will manage distributing the traffic across multiple zones, deploying and updating your application across multiple zones, and all the details that go along with that. I would not recommend diving straight in and trying to do all this manually in EC2 if you are new to AWS.
Sorry, I had a few basic questions. I'm planning to use an AWS EC2 instance.
1) Is an EC2 instance a single virtual machine image or is it a
single physical machine? Documentation from Amazon states that it is
a "virtual server", but I wanted to clarify if it is an image
embedded inside one server or if it is an single physical server
itself.
2) Is an Elastic Load Balancer a single EC2 instance that handles
all requests from all users and simply forwards the request to the
least loaded EC2 instances?
3) When Auto-Scaling is enabled for an EC2 instance, does it simply
exactly replicate the original EC2 instance when it needs to scale
up?
An EC2 instance is a VM that gets some percentage of the underlying physical host's RAM, CPU, disk, and network i/o. That percentage could theoretically be 100% for certain instance types, including bare-metal instances, but is typically some fraction depending on which instance type you choose.
ELB is a service, not a single EC2 instance. It will scale on your behalf. It routes by round robin for TCP, and routes on fewest outstanding requests for HTTP and HTTPS.
Auto Scaling is "scale out" (it adds new EC2 instances), not "scale up" (resizing an existing EC2 instance). It launches a new instance from a template called an AMI.
It is a virtual server, a VM, as stated in the documentation.
It's a little more complicated that that, based on the way AWS might scale the load balancer, or create a version in each availability zone, etc. It also provides more features such as auto-scaling integration, health checks, SSL termination. I suggest you read the documentation.
It uses a machine image that you specify when you create the auto-scaling group (when you create the Launch Configuration used by the Auto-scaling group to be more precise). A common practice is to configure a machine image that will download any updates and launch the latest version of your application on startup.
You might also be interested in Elastic Beanstalk which is a PaaS that manages much of the AWS infrastructure for you. There are also third-party PaaS offerings such as OpenShift and Heroku that also manage AWS resources for you.