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.
Related
Is it possible to prevent Amazon Elastic Beanstalk from dropping an instance and creating a new one on its own, like for it to ask for approval first. I run a redis instance locally because elasticache is quite expensive and I dont want to have to keep installing and starting redis every time elastic beanstalk drops the instance and starts a new one. Is it possible to make sure it keeps a specific instance of EC2?
Elastic Beanstalk is meant for scaling web applications, so I'm not sure it's the right tool here.
If you are just looking to run a single instance with a manual install of redis at low cost, then launching an EC2 instance directly (rather than using Elastic Beanstalk) may be more appropriate?
You would of course then need to bear in mind that the EC2 would not automatically recover in the event of a problem, but it sounds like you don't have that currently anyway.
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
I have an spring boot application which is deployed on EC2 server which runs fine.
But after a certain amount of time, that task is killed automatically. I have tried to search for a solution but couldn't find any or may be I didn't exactly know what to search for. And hence the question on SO.
Is there anything that I can implement which will keep on pinging the instance which will keep it alive?
If yes, how do I implement it? And do I have to consider any other drawback for doing this?
Option 1. Elastic Container Service
Dockerize your app. Create a ECS cluster and publish you service. You Docker container will still run on a EC2 instance, but ECS will automatically maintain the number of app instances "alive". If you container gets killed (because the main Java process got killed), ECS will automatically restart the container.
Option 2. Elastic Beanstalk
Publish your Java app with Elastic Beanstalk and it will automatically monitor the "health" of you web app, and replace "unhealthy" EC2 instances automatically. It only works for web apps, since Elastic Beanstalk does HTTP(S) checks calling a URL you specify.
Option 3. Use Elastic Load Balancer with Auto Scaling Group
ELB can do HTTP(s) checks on you app. If an instance doesn't respond, it will be automatically replaced. You will require to create an AMI or cloud-init script to bootstrap new instances.
I don't understand the use for AWS EC2 and RDS as separate services.
Is an EC2 instance a necessary prerequisite of launching an RDS instance? Can you have a database on your EC2 instance?
RDS is a database-as-a-service; you don't know or care what it is running on, because you don't install it, manage it or perform any of the maintenance on the box it runs on (i.e. software updates). AWS takes care of all of that for you and simply charges you by the hour for using the service.
You can install SQL Server or MySQL (or any other database) on your own EC2 instance, but now its your responsibility to administer. Both are valid uses cases, but in general, for small databases, and especially for test and dev databases, I install SQL Server on my own EC2 instances and manage it myself to have flexibility and save money.
For larger, more critical and production databases, RDS is often a better choice - at a higher cost. The best scenario for you will depend on a lot of things (your budget, your skills, the need for high availability etc).
You can install any databases on ec2 instance (whatever in windows or Linux). ec2 is a standalone virtual server with your fully control
But RDS service, you needn't care of the detail on how to install the database, set the environment, upgrade the version, backup/restore, multi-AZ setup, and so on, AWS RDS Service will take care all of them. Get it ready and you can immediately connect it and start your work. The way to provide RDS services are very similar as service elasticache (memcached & redis)
There is no require for you to launch a new ec2 instance for RDS service setup.
Don't mix ec2 and RDS. They are separate services.
Another way to make you understand this question is,
Amazon RDS is a Software as a Service (SaaS) that provides a full featured relational database service
I created a elastic beanstalk environment and it created an EC2 instance. Then I thought I don't actually need this yet so I'll stop the EC2 instance, but then it seemed to start another one.
So my question is if I have an EB instance will I be charged by the hour for the underlying EC2 image all the time or only when the the service it provides is being access via the public elasticip. And if Im charged all the time is there a way to halt a elastic beanstalk application or only delete it or instantiate to a new environment.
The auto scaling feature of Elastic Beanstalk will automatically start another instance if a current instance continues to fail a health check. Stopping individual instances outside of the environment will cause failed health checks and trigger a new instance to be spun up.
You will be charged when the components within the environment are running as stated by Amazon here:
There is no additional charge for Elastic Beanstalk – you only pay for the underlying AWS resources (e.g. Amazon EC2, Amazon S3) that your application consumes.
You can completely stop an environment through the CLI. I gave this answer to a previous question about starting and stopping Elastic Beanstalk:
The EB command line interface has an eb stop command. Here is a little bit about what the command actually does:
The eb stop command deletes the AWS resources that are running your application (such as the ELB and the EC2 instances). It however leaves behind all of the application versions and configuration settings that you had deployed, so you can quickly get started again. Eb stop is ideal when you are developing and testing your application and don’t need the AWS resources running over night. You can get going again by simply running eb start.