How to move/clone an Elastic Beanstalk Environment between (Elastic Beanstalk) Applications - amazon-web-services

I'm new to AWS. For simplicity I have been working with a number of separate Elastic Beanstalk Environments, within the same Elastic Beanstalk Application
I have come to understand that Applications are just folders for Environments.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.html
I'm just trying to get more organized. Is it even possible?

First of all, applications are not literally folders for environments, according to the documentation an application is "a logical collection of Elastic Beanstalk components".
The idea behind it is to have a single codebase that get deployed to several environments with different configuration depending on your needs. You can have several application versions (or the same version if you want it that way) deployed in several scenarios (environments) with varying configurations, let's say different environment variables, or different values for them, different infrastructure, etc. So, from my point of view there's not much logic in cloning an environment to a different application, since usually different applications would require different configurations.
But, if for your particular needs, you have very similar applications (they use the same platform, consume some of the same resources and basically you wanna deploy them in a very similar way infrastructure-wise) I think a good idea could be writing configuration files for your desired environment and just add those to your different application's code (you can find the official documentation on .ebextensions here, they even give you this link with several common configuration files). Another approach could be directly using CloudFormation templates as discussed here and just recreate the entire application from a CF template.
I hope this helped

Just for someone like me who came here for solutions...
Actually you can clone a environment from one Application to another Application with some steps.
Just follow this AWS - How do I migrate my Elastic Beanstalk environment from one AWS account to another AWS account?
This doc tells you how to do it between 2 AWS accounts but you can do it in just one account. The idea is just:
Save Config in one Application
Load Config in another Application

Related

Is it recommended to have multiple deployments of same application in same AWS region?

I had a requirement where it might be possible I would need to support different versions of the application at the same time which is kind of a business requirement.
One way of doing this would be to deploy the app in different regions. But it might also be required to run the same app in one region multiple times.
Of course, it can be done by parameterising the deployment scripts but will it lead to some issues?
One I can think of is same app running in the same region might consume the same resources and it might hit some of the regional limits. Are there any other issues I should be aware of?
We need more background information on your actual tech stack and more detailed requirements.
Running multiple versions of multiple deployments is something that a lot of companies manage on AWS. CI/CD pipelines and many other topics are very helpful, but I am fishing in the dark here.
You can certainly run those multiple deployments in one region.
For a first start, have a look at Elastic Beanstalk environments:
"You can deploy multiple AWS Elastic Beanstalk environments when you need to run multiple versions of an application."
And this gets you started on Elastic Beanstalk.

How to host based routing different version in same AWS EB application

The question come from here that recently I am required to start a new project using AWS, while I was GCP developer before.
In GCP, I can deploy my application to AppEngine(similar to EB) with versioning like gcloud app deploy settings.yaml --version dev. Such that I can have host based routing on two links --
my-project.xxxx.com
dev.my-project.xxxx.com
Such that I can let others to have a domain for testing without starting an new instance, sharing all environment settings, dbs and storage.
However, when I come to AWS, it seems the story is completely different.
I try to follow this guide https://aws.amazon.com/blogs/aws/new-host-based-routing-support-for-aws-application-load-balancers/, but it is just for routing to different instances.
By the way I know that EB application can have multiple versions, so is it possible to do something like
my-project.xxxx.com -> go to default version
dev.my-project.xxxx.com -> go to version with tag 'dev'
So 2 questions,
Can I achieve what I want?
If can't, is starting another EB instance for testing only choice?

AWS Code deploy - How to use single deployment to deploy the artifacts for multiple services in multiple machines

I was looking around aws code deploy to perform deployment. My application will have multiple services like apache, tomcat, database, cassandra, kafka and etc..
Each services will run in different machines. As per my knowledge it looks like i need to create different deployment group for each services(because each services running in different instances) and different deployment for each services.
So for example, if i have around 5 different services in my application and each running in different instance, do i need to create 5 deployment group and 5 different deployment in aws code deploy ? Is there any option to perform deployment for all the services using a single deployment/appspec file ? I would like to get some ideas from experts on how we can accomplish this effectively.
If I understand your use case correctly, you have an application that is made up of 5 different services. Every service runs on a different set of instances. You want to know if you can deploy all 5 services to a different set of instances with one deployment? That's not possible without doing some really hacky things in your appspec.yml, which would not be recommended. A deployment is tied to one deployment group and one revision.
The Recommended Way
If you want to do this with CodeDeploy, you can break it up with applications or deployment groups. There is no way to have a deployment group with a mix of different services for different instances.
Ideally, each service in your application has it's own CodeDeploy application, and each application would have one deployment group. You could use a deployment group for that as well in the same application, but conceptually, a deployment group is intended to break up a fleet with the same service running, though it doesn't really matter.
Installing applications you don't code
If you're talking about installing applications you don't own like a DB or Apache, the EC2 user data is probably the place you want to install that with.

Spring boot/cloud microservices on AWS

I have created a Spring cloud microservices based application with netflix APIs (Eureka, config, zuul etc). can some one explain me how to deploy that on AWS? I am very new to AWS. I have to deploy development instance of my application.
Do I need to integrate docker before that or I can go ahead without docker as well.
As long as your application is self-contained and you have externalised your configurations, you should not have any issue.
Go through this link which discusses what it takes to deploy an App to Cloud Beyond 15 factor
Use AWS BeanStalk to deploy and Manage your application. Dockerizing your app is not a predicament inorder to deploy your app to AWS.
If you use an EC2 instance then it's configuration is no different to what you do on your local machine/server. It's just a virtual machine. No need to dockerize or anything like that. And if you're new to AWS, I'd rather suggest to to just that. Once you get your head around, you can explore other options.
For example, AWS Beanstalk seems like a popular option. It provides a very secure and reliable configuration out of the box with no effort on your part. And yes, it does use docker under the hood, but you won't need to deal with it directly unless you choose to. Well, at least in most common cases. It supports few different ways of deployment which amazon calls "Application Environments". See here for details. Just choose the one you like and follow instructions. I'd like to warn you though that whilst Beanstalk is usually easier then EC2 to setup and use when dealing with a typical web application, your mileage might vary depending on your application's actual needs.
Amazon Elastic container Service / Elastic Kubernetes Service is also a good option to look into.
These services depend on the Docker Images of your application. Auto Scaling, Availability cross region replication will be taken care by the Cloud provider.
Hope this helps.

code deployments on EC2

There are quite a few resources on deployments of AMI's on EC2. But are there any solutions to incremental code updates to a PHP/Java based website?
Suppose I have 10 EC2 instances all running PHP / Java based websites with docroots local to the instance. I may want to do numerous code deployments to it through out the day.
I don't want to create a new AMI copy and scale that up to new instances each time I have a code update.
Any leads on how to best do this would be greatly appreciated. We use subversion as our main code repository and in the past we've simply done an SVN update/co when we were on one to two servers.
Thanks.
You should check out Elastic Beanstalk. Essentially you just package up your WAR or other code file, upload it to a bucket via AWS's command line/Eclipse integration and the deployment is performed automatically.
http://aws.amazon.com/elasticbeanstalk/
Elastic Beanstalk is exactly designed to do this for you. We use the Elastic Beanstalk java/tomcat flavor but it also has support for php, ruby, python environment. It has web console that allows you to deploy code (it even keeps history of it), it also has git tool to deploy code from command line.
It also has monitoring, load balancer, auto scaling all built in. Only a few web form entries to control all these.
Have you considered using a tool designed to manage this sort of thing for you, Puppet is well regarded in this area.
Have a look here:
https://puppetlabs.com/puppet/what-is-puppet/
(No I am not a Puppet Labs employee :))
Capistrano is a great tool for deploying code to multiple servers at once. Chef and Puppet are great tools for setting up those servers with databases, webservers, etc.
Go for a Capistrano . Its a good way to deploy your code on multiple servers .
As already mentioned Elastic Beanstalk is a good option if you just want a webserver and don't want to worry about the details.
Also, take a look at AWS CodeDeploy. You can have much more control over the lifecycle of your instance and you'd be looking at something very similar to what you have now (a set of EC2 instances that you setup). You can even get automatic deployments on instance launch with Auto Scaling.
You can either use Capsitrano or TravisCI.