Elastic Beanstalk Moded Environment variables - amazon-web-services

I have a IIS web application that I want to deploy to a UAT environment as well as a PROD environment. The application has quite a few setting that need to change based on the environment the environment.
What's the best way to set this up so that:
When I press F5 / use the local development web server I can select which env I want to emulate.
Mark an EC2 environment as UAT or PROD and have it apply a given set of settings easily.
I have read through all the .ebextensions documentation and can't quite find an elegant solution. I must be missing something here.

Related

Is there a way to create a Beanstalk configuration template outside of an "application"?

I think I'm missing something here with Beanstalk's concept of "application"
I have about 30 apps. I want them to be in Beanstalk.
I was going to create 30 Beanstalk "applications" and deploy each app to its own application (with its own environment).
But Beanstalk configuration templates MUST be bound to a beanstalk application? That makes no sense. About 80% of the Beanstalk environment settings for these 30 apps are the same so naturally I want to create a configuration template they all can use for default settings.
Well, I can't do that because templates need to be attached to a specific application.
So should I have ONE application and have each of my 30 apps be deployed to their own "environment" under that single application? This is the only way I can use a single configuration template? Is this the right way to use Beanstalk? It feels wrong because of the terms "application" and "environment".
To answer your question about one application for 30 apps depends on your use case ofcourse. How I use EB is one application which has a preproduction environment and a production environment (within the same application);
You probably want multiple applications with each an production environment. If you would setup these 30 apps through the AWS console you would have bad time. Luckly you can write all the configuration you are doing down in .yaml; to help you get started I can point you to the documentation of AWS:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/beanstalk-environment-configuration-advanced.html

Programmaticaly configuring an RDS instance for Elastic Beanstalk

I am trying to automate the creation of the temporary environment, I am struggling with the creation of a related RDS instance inside Elastic Beanstalk.
I would like that when I call eb create envName the environment also spawns an RDS database.
One solution would be to manually do it. Another solution seems to involve '.ebextensions' Using Elastic Beanstalk .ebextensions to specify an RDS database , though .ebextensions are to be run at each deployment, this could fit through a specific hook, but I would like to have my config in .elasticbeanstalk/config.yml because this is the file that seems to have preconfiguration for when I call eb commands.
One of the reason to not but it in .ebextensions is also that in the project configuration, those are not environment specific, they describe the requirements for the app in any environment.
I personally believe it is a bad idea to create the database as part of the environment, as it is a lot harder to deal with stopping and recreating the environment if you need to. I believe it is a lot easier and safer to keep the database running even if you want to completely destroy the environment and start all over. I believe most experience users will recommend you to manage the RDS on your own (outside EB). It is really easy anyway.
That said (and given you didn't ask for that), you can simply create a database as part of the eb create command itself:
eb create -db -db.engine postgres -db.version 9.4 -db.user dbroot -db.i ...
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-create.html

Automatically setup a AWS Environment

I wanted to know if there is a way to setup a cloud environment using Amazon Web Services automatically (like by just invoking a batch file...).
I have a scenario where i want to setup the Environment with all the requisite things like OS, Platforms etc. I want to automate the entire process of setting up the environment. Is this possible?
I am trying to do Continuous Integration and as a part of CI i want to first set up the environment for the application to be deployed, deploy the application and then run automated and performance tests. i am using Jenkins to run my automated and performance test cases with Selenium and Jmeter. Kindly help me.
You can use different tools based on your requirement.
If you also want to configure VPC and other network level configuration, you can use cloud formation, basically you'll create a template and launch your infrastructure using this template file.
https://aws.amazon.com/cloudformation/cloufformation
if you need to launch an project with a database, application server (tomcat, java, python, ...) and with load balancing and autoscaling configuration, you can use elasticbeanstalk
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html
opswork, docker could be also an option depending on your requirements. But they need pre configuration.
Would be more easy to advise a solution if you extend question with your use case.

Change which RDS database an AWS EB environment uses

How can I change which RDS database my EB environment uses? I.e. where are the settings that specify this?
I have cloned an environment and want to change the database it uses to an existing RDS database rather than the one that was created when the environment was cloned.
Is your environment using EB?
In that case you can set in the environment variables:
in case you are reading them.
Maybe that might be useful:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.RDS.html?console_help=true
**Scroll down to see how to use an existing RDS instance after open your specific language page

Using the JetBrains AWS Elastic Beanstalk integration plugin

I'm using the excellent JetBrains AWS Elastic Beanstalk integration plugin (in PyCharm) but have a few related questions on how to accomplish things and how it integrates with the behavior of AWS's eb command line tool:
Is there a way to take advantage of EB's association between git branches and EB environments? The plugin doesn't seem to use this mapping and instead uses the environment specified in the run configuration dialog.
The URL that the application given as being "available at" is wrong. Is this a known bug? Is it something that I can fix?
Is there any way to have multiple run configurations for a given deployment (e.g. with different environment names)? Right now whenever I change the environment in one of my run configurations for a deployment, the other run configurations also switch to that environment.