How can I get the RDS host of an elastic beanstalk environment? - amazon-web-services

How can I get the RDS host of an elastic beanstalk environment? I setup an EB env with:
eb create --database ...
Now I want to upload a SQL dump to this new environment without connecting to any server of this EB environment. Since the information is in the environment variables, I thought I could find out it with eb printenv but that does not work.

the information exists in the beanstalk web console (Data Tier section on the environment's Configuration page) as described in this document

Related

Retrive or Restore Elastic Beanstalk Config File

How do I retrieve/restore my Elastic Beanstalk config file?
My hard-drive failed and I lost my Elastic Beanstalk config yaml file. I've looked around the eb CLI to no avail.
If you would like to know your environment variables its under
Your EB Environment -> Configuration -> Software

How can I install phpmyadmin in my beanstalk ec2 environment

I have deployed my Codeigniter app into aws beanstalk environment and then I created a RDS instance inside the environment. And I set the ingress rule into the RDS so as to allow the inbound traffic only from the beanstalk ec2 instance.
And I have checked the mysql access to RDS instance from the ec2 through ssh and run the below command and all works fine there.
"mysql -h {RDS_Host} -P 3306 -u {RDS_Username} -p"
Now I want to access the RDS database using phpmyadmin which is installed in beanstalk ec2. So can anybody please explain about how to install and configure phpmyadmin in beanstalk ec2 instance so that I can access the RDS using that.
Note: I am using the EB CLI to deploy each versions of my app.
This is how i setup my phpmyadmin on ELB instance:
1) Download PHPMyAdmin from official site: https://www.phpmyadmin.net/
2) Unzip file in your dev directory (ex: yoururl.com/phpmyadmin)
3) Open the config.sample.inc.php, edit with your RDS credentials, save and rename to config.inc.php
4) Delete /setup dir
5) Deploy with the new archives
6) Be happy! :)

How to connect to existing elastic beanstalk instance locally from cli?

I am very much new to aws. I have created an environment in elastic beanstalk and deployed my application there using zipped code. The application is up and running now. Now i want to stop and start my elastic beanstalk instance from cli in windows. I could not find any stop button in the aws elastic beanstalk console.
I have installed awsebcli using below command:
pip install awsebcli
Now, i want to connect to my existing environment in elastic beanstalk and stop or start the environment at my will.
How can i do that?
The way the EBCLI (awsebcli) works is that you associate an empty directory on your computer with an EB application.
go to an empty directory
eb init --region <region name>. When prompted for the application name, choose the application you created previously.
eb terminate <environment name>. This will terminate the environment.
To create a new environment, perform eb create.

Elastic Beanstalk Change ELB Type

Does anyone know if it's possible to change an existing AWS Elastic Beanstalk environment to an Application Load Balancer (instead of a classic one).
As far as I know only Application ELB's can be protected with AWS WAF and DDOS "Shield" so any existing EB app can't take advantage of these features since they have classic ELB's.
It is not possible to change the load balancer type for an existing environment but I have used the following process to create a cloned environment with an application load balancer (instead of classic).
In the console, save configuration of the original env.
In terminal, eb config get [save name], you will get a file in .elasticbeanstalk\saved_configs .
Edit the file to add
OptionSettings:
aws:elasticbeanstalk:environment:
LoadBalancerType: application
and remove (if you have those):
aws:elb:loadbalancer:
CrossZone: true
aws:elb:policies:
ConnectionDrainingEnabled: true
aws:elb:listener:443:
[whatever]
You can use this opportunity to do other changes, such as upgrade PlatformArn
Save modified config as [new save name].
In terminal, eb config put [new save name] .
Update your .ebextensions to have LoadBalancerType: application and optionally add listener to elbv2. You can also create in the console manually later.
aws:elbv2:listener:443:
ListenerEnabled: true
SSLPolicy: ELBSecurityPolicy-TLS-1-2-2017-01
SSLCertificateArns: [your cert id]
DefaultProcess: default
Protocol: HTTPS
Rules: ''
Create a new env with eb create [new env name] --cfg [new save name]
Now you will have a new environment with a different load balancer type side-by-side with your old environment. You can perform testing, make further configuration changes and then if all is well, swap CNAMEs and terminate the previous environment.
Hello As Per AWS Documentation:
The Elastic Beanstalk Environment Management Console only supports
creating and managing an Elastic Beanstalk environment with a Classic
Load Balancer. For other options, see Application Load Balancer and
Network Load Balancer.
Also
Note You can only set the load balancer type during environment
creation. (Refer AWS Documetnation)
So When you deploy application to Elastic Beanstalk via AWS CLI:
Try
eb create test-env --elb-type network
or
eb create test-env --elb-type application
The easiest way I've found to change an existing application to use the application load balancer is using both the Console and CLI:
In the console, save the application configuration of the original env. Note this name down. We'll use it as <saved-config-name>.
Under the Application versions note the latest Version Label. We'll use it as <app-version>.
From the CLI run eb create <new-environment-name> --elb-type application --cfg <saved-config-name> --version <app-version>
If you had HTTPs configured in the old application, in the newly created application reconfigure it in the Console under Load Balancer-->Listeners with the proper certificate.

How can automatic deploy yii2 app when Elastic Beanstalk instance is terminated and created a new instance

Currently I have setup my yii2 website on AWS Elastic beanstalk. I followed following steps :
Created Elastic Beanstalk app and environment : Platform PHP 7.0, RDS database
Created SSH connection from EC2 instance of elastic beanstalk using putty with .pem file
In Apache folder I have cloned my yii2 git repo using (sudo git clone repo_url) command
Installed composer using this link https://gist.github.com/asugai/6694502
Run command : (sudo composer install) in my repo folder
Edited common/config/main-local.php and made db connection
And run migration using (sudo php yii migrate)
Setup a domain for this elastic beanstalk app
Now I don't know how should I proceed further and I am facing following problems :
Elastic Balance loader is creating new instance and terminating current one when it fails or health goes in severe.
Due this, my all data in that instance is lost. To make it work I am doing all steps again and again manually.
How can I make my domain https (SSL certified)
How can make easy process to pull new changes from git
I already have a working site in nodeJS. which is using elastic beanstalk, elastic balance loader, RDS(postgres), S3 bucket, cloudfront for Route 53, SSL certificate (https), code pipeline, code commit. And AWSCLI at local to deploy nodeJS app.
my question is about I want to use same flow for yii2 advance app.
Can anyone please help me here?
Thanks in advance :)