How can I change the auto-hibernate settings on a AWS Cloud9 EC2 Instance - cloud9

While setting up the AWS Cloud9 EC2 instance, I selected 30 mins for auto-hibernation. I would like to change this to X time/Never. How do I do that?

Now you can login to the Cloud9 and change the value as per your need:
vim ~/.c9/autoshutdown-configuration
e.g SHUTDOWN_TIME=120

Related

How can I change the default phpMyAdmin access URL for AWS EC2 running Linux AMI

I just installed MySQL and phpMyAdmin on my AWS EC2 instance running Linux AMI. I would like to find out how to change the default URL to access phpMyAdmin, which is currently /phpMyAdmin. I found an article on how to do this:
https://www.tecmint.com/change-secure-phpmyadmin-login-url-page/
but there is no such file: /etc/httpd/conf.d/phpMyAdmin.conf. The only config file I can find is the sample config file: /var/www/html/phpMyAdmin/config.sample.inc.php. But this sample config file doesn't seem to have anything about url alias.
Would appreciate some help on this, thanks!

Clustering in Ejabberd in 2 linux OS

I am currently trying to cluster ejabberd using 2 ubuntu instances but I am facing some problems. I have 2 instances inside oracle Virtual Box .My current ejabberd.yml file for both instances have the following host:-
hosts:
- "xyz-VirtualBox"
For node1 I modify the ejabberdctl.cfg and change the ejabberd name like the following for example
ERLANG_NODE=ejabberd#1.1.1.1
INET_DIST_INTERFACE=1.1.1.1
where 1.1.1.1 is the ip of my ubuntu machine 1 instance .I make sure that I have the same .erlang.cookie in 2nd ubuntu machine and done the same changes of NODE and INTERFACE for machine2 . I start my first instance by using
ejabberdctl start
and it works fine because I can access the webadmin console. I start my ejabberd on second instance using using
ejabberdctl start
and it runs fine when I try to add the cluster to instance using the following command
ejabberdctl --no-timeout join_cluster ejabberd#1.1.1.1
Error: {no_ping,'ejabberd#1.1.1.1'}
note - cmd> hostname --fqdn (machine 1 output - xyz-VirtualBox)
I guess you have this in machine 1:
ERLANG_NODE=ejabberd#1.1.1.1
and something like this in machine 2:
ERLANG_NODE=ejabberd#1.1.1.2
Can machine 2 connect to machine 1. I mean, In machine 2, does this work?
ping 1.1.1.1
If that pings correctly, then you can test with step 4 of that tutorial, to see if that works: https://ejabberd.im/interconnect-erl-nodes/index.html

Connecting to Amazon RDS instance through EC2 instance using MySQL Workbench Security groups

I'm having difficulty to connect mysql Workbench to RDS. I contacted amazon support and they told me this
"I've looked at the configuration of the EB environment and the SG's and they're now in good order, the only item left, as I see its not possible to connect to the RDS DB remotely, the SG sg-882213c3 needs to have another rule added to allow connectivity from the computer with the mysql client. Perhaps, allow 0.0.0.0/0 to TCP port 3306 for temporary access or from the source IP of the computer."
so what I did is this
but the connection still failing
the pervious steps are
I created new new DB Instances called east-mysql2-instance1. For east-mysql2-instance1 Security group is set to rds-launch-wizard (sg-882213c3) and i did modify the inbound to Source sg-882213c3 (rds-launch-wizard). but it wont let me change the type to Mysql/Aurora it stays at custom TCP Rule.
for EC2 Instance I have 2 running instances and I changed both Security groups to
rds-launch-wizard and awseb-e-bdbjjgxvzd-stack-AWSEBSecurity
I terminate my old environment and created new one called Borroup-env-1, I changed the EC2 security groups for the environment to awseb-e-bdbjjgxvzd-stack-AWSEBSecurityGroup-1PTJG896MEOYR and rds-launch-wizard.
I changed Environment properties and added RDS_DB_NAME, RDS_HOSTNAME, RDS_PASSWORD, RDS_PORT, RDS_USERNAME
From your second screenshot, it looks like you are setting up a connection that is:
SSH from your mac desktop to an ec2 instance
connect form the ec2 instance to RDS
If this is the situation you are wanting to achieve I would not be leaving a rule allowing 3306 from 0.0.0.0/0. This is allowing any IP address in the world to connect on port 3306 - a well known port. Additionally, that advice seems to suggest putting that rule against the RDS instance? Overkill - only needs to allow access from your EC2 instance or its subnet.
The first step I would take is use SSH on terminal to verify you can SSH from your mac to the EC2 instance - if this is not working, no point looking at SGs and rules between EC2 and RDS. Once that is working, you can move forward to resolving the connectivity from the ec2 to the RDS. As John noted above, if both the RDS and the EC2 are in the same VPC, you can setup a SG allowing access to the RDS instance from the subnet that the EC2 is in.
As an alternative solution, you can also setup to allow access to the RDS instance directly, without going through the EC2. See Public Accessibility and also subnet requirements here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html Depends on what kind of setup you want...
If the EC2 and RDS are not in the same VPC but are in the same region, you may want to look at setting up VPC peering: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-peering.html If they EC2 are RDS are not in the same region or same VPC, you may want to setup Inter region VPC peering: https://aws.amazon.com/about-aws/whats-new/2017/11/announcing-support-for-inter-region-vpc-peering/
It sounds like you wish to connect from an Amazon EC2 instance to an Amazon RDS instance. Assuming that they are both in the same VPC, the easiest way to configure it is:
Create an App-SG security group and associate it with the EC2 instance. Grant whatever access you need to login/use the instance.
Create a RDS-SG security group and associate it with the RDS database. Permit inbound access from the App-SG security group on port 3306 (MySQL/Aurora).
This basically says that any resources associated with App-SG will be permitted to access any resource associated with RDS-SG.
If that doesn't work, then there's something else (aside from security groups) that needs to be configured.

How to choose the EC2 Instance type of an Elastic Beanstalk environment when creating it using awscli?

I've been through all the documentation (I guess). And haven't found a way, yet, to choose which EC2 instance type to use for my environment.
You can specify it when you create your environment. (It will overwrite what you selected when you did eb init)
eb create --instance_type t2.micro
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-create.html
You can also set it in your .ebextensions/config
option_settings:
aws:autoscaling:launchconfiguration:
InstanceType: t2.micro
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html

Change max_connect_errors in MySQL

I need to change max_connect_errors on MySQL but I have no SSH control into the server, can you change it just using a mysql query?
If not can anyone advise how I would change this on amazon's RDS service? It doesn't seem to be in their parameter options.
Thank you!
Here's how I fixed it:
Create a new db parameter group (using command line tools, or console)
Change max_connect_errors in the new parameter group. My command looked like this
rds-modify-db-parameter-group -C cert-xxxxxx.pem -K pk-xxxxx.pem --db-parameter-group-name=customdb --parameters "name=max_connect_errors,value=10000,method=immediate"
or it can be done in the console.
Modify your database in console to use new parameter group
Restart rds instance. When it comes back it will use the new parameter group with the higher max_connect_errors
It seems Amazon now allows changing this parameter.
You might also want to set skip_name_resolve to 1, unless you need it.
First you need to create an RDS parameter group. This is a "profile" of settings that you can apply to your RDS instance.
Next, you need to use the RDS command line client, or API tools to make the settings modifications to your RDS parameter group.
You also need to make sure the RDS parameter group is applied to your RDS instances
Dave
The parameter groups can now be modified fully within the console with a handy search for value fields. Some of the AWS documentation and many answers out there to this kind of question point to setting up the CLI which is no longer necessary.
As mentioned earlier; you can set skip_name_resolve to 1. This will bypass the logic as it will stop performing reverse DNS lookups to resolve host names from the connected client.
In AWS you can use security groups to block systems that should not have access to the MySQL server.
For RDS, you will have to adjust the values of the parameter by editing the parameter group attached to your RDS instance.
show variables like 'max_connect_errors';
/* to show current setting */
set global max_connect_errors=100000000;
/* or any number you want */
make sure you login as an user have privileges to execute set global
This is no good for amazon-rds