Page 6 of 6

AWS Elastic Beanstalk how to access to the RDS environment variables under ebextensions and postdeploy hooks

Facebooktwittergoogle_pluslinkedinmailby feather

As a beginning, just to let you know, it is now my 54th deployment (which means around a week) using ebextensions in order to reverse engineering how it works in terms of environment variables!

The RDS environment variables are:

– RDS_USERNAME

– RDS_PASSWORD

– RDS_HOSTNAME

– RDS_DB_ NAME

The weird part is, accessing to those environment variables under the following 3 scenarios are different:

1. Directly under ebextensions : This is not possible !

2. Under the scripts triggered by ebextensions : This is possible, you can use them like $RDS_HOSTNAME …

3. Under the hooks  : This was not possible but here is the workaround that i found and worked for my case:

– Store them under a file using a script trigged by ebextensions:

echo RDS_HOSTNAME=$RDS_HOSTNAME >> /etc/environment
echo RDS_USERNAME=$RDS_USERNAME >> /etc/environment
echo RDS_PASSWORD=$RDS_PASSWORD >> /etc/environment

– Parse them from the hook:

RDS_HOSTNAME="$(awk -F= '/RDS_HOSTNAME/{print $2}' /etc/environment)"
RDS_USERNAME="$(awk -F= '/RDS_USERNAME/{print $2}' /etc/environment)"
RDS_PASSWORD="$(awk -F= '/RDS_PASSWORD/{print $2}' /etc/environment)"

What a nasty solution but works!

 

AWS Elastic Beanstalk ebextensions Security Group firewall rules

Facebooktwittergoogle_pluslinkedinmailby feather

In order to define the firewall rules of the Security Group that the instance will belong to, you need to define the “Resources” like as the following:

Resources:

  AWSEBSecurityGroup:

    Type: “AWS::EC2::SecurityGroup”

    Properties:

      GroupDescription: “Security group to allow HTTP, HTTPS,SSH”

      SecurityGroupIngress:

        – {CidrIp: “0.0.0.0/0”, IpProtocol: “tcp“, FromPort: “8080”, ToPort: “8080”}

        – {CidrIp: “0.0.0.0/0”, IpProtocol: “tcp“, FromPort: “8443”, ToPort: “8443”}

        – {CidrIp: “0.0.0.0/0”, IpProtocol: “tcp“, FromPort: “443”, ToPort: “443”}

        – {CidrIp: “0.0.0.0/0”, IpProtocol: “tcp“, FromPort: “80”, ToPort: “80”}

        – {CidrIp: “0.0.0.0/0”, IpProtocol: “tcp“, FromPort: “22”, ToPort: “22”}

Save the “resources.config” under “.ebextensions” folder and deploy!

      

AWS Elasticbeanstalk hooking after app deploy

Facebooktwittergoogle_pluslinkedinmailby feather

I need to run a specific command after the app is deployed but there is no relevant key under ebextensions for that purpose. The key “container_commands” is not giving this functionality, runs your command before the deploy, but there is a workaround:

1. Create your own script and place it under .ebextensions directory

2. Under container_commands, add the following lines (preferably in a separate config file):

container_commands:

         01-command:

         command: cp .ebextensions/001_pre_tomcat_start.sh /opt/elasticbeanstalk/hooks/appdeploy/post

      02-command:

         command: chmod 775 /opt/elasticbeanstalk/hooks/appdeploy/post/001_pre_tomcat_start.sh

That’s it!

OSX Yosemite Bluetooth Mouse stopped working

Facebooktwittergoogle_pluslinkedinmailby feather

Honestly, I was just thinking of the stability of OSX Yosemite and just after suddenly the connection with Bluetooth mouse is broken (What a coincidence!) and cannot be established again even i unpair and pair. Beside, the Bluetooth seems not responsive when i tried to disable it.

As a veteran Linux guy, i switched to the terminal and typed the following command:

killall blued

This helped the daemon to restart itself (watchdog starts it again)

Eclipse Maven plugin installation

Facebooktwittergoogle_pluslinkedinmailby feather

After installing my Linux OS again, seems the previous link under www.sonatype.org/m2eclipse is broken, so here is the brand new installation steps for Maven Eclipse:

1. Install SLF4J Logging :

Eclipse –> Help –> Install New Software

Work with: http://www.fuin.org/p2-repository/

Click “Add”

Select Slf4j-api under Maven osgi-bundles

Click “Next”

2.  Install Guava:

Eclipse –> Help –> Install New Software

http://guava-osgi.googlecode.com/svn/trunk/repository/

3.  Install Maven 1.4 (Not the latest version)

Maven 1.5 seems have problem with Eclipse 3.8

Eclipse –> Help –> Install New Software

http://download.eclipse.org/technology/m2e/releases

Uncheck “Show only the latest versions of available software”

Choose version 1.4

4 . Import the existing Maven project:

File –> Import –> …

Play with the CPU frequency under Linux

Facebooktwittergoogle_pluslinkedinmailby feather

After installing Ubuntu on my legacy laptop, i noticed that the CPU frequency is scaling down to 800 Mhz. (upon to the temperature i guess)

derya@dsezenlinux:~$ cat /proc/cpuinfo

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz
stepping : 6
microcode : 0x607
cpu MHz : 800.000

When it is 800 Mhz. the computer becomes extremely slow, so i decided to keep it stabile at 2500 Mhz.

Steps:

1. Install cpufreq-selector

For Ubuntu, this is under gnome-applets pack:

sudo apt-get install gnome-applets

2.  Run the following for each core:

sudo cpufreq-selector -c 0 -g performance

sudo cpufreq-selector -c 1 -g performance

3. Check if it is ok:

cat /proc/cpuinfo

 

How to place a list of Latitude and Longitude coordinates on a map

Facebooktwittergoogle_pluslinkedinmailby feather

If you have a list of latitude and longitude coordinates and need to place them on a map, you can use

https://en.batchgeo.com/

in order to batch upload the coordinates.

 

 

Connecting to AWS EC2 instances without a private key

Facebooktwittergoogle_pluslinkedinmailby feather

Sometimes this may be required, here is the practical way to do that:

 

useradd -s /bin/bash -m -d /home/YOURUSER -g root YOURUSER

passwd YOURUSER

visudo

USERNAME  ALL=(ALL:ALL) ALL

vi /etc/ssh/sshd_config

PasswordAuthentication yes

/etc/init.d/ssh restart

 


visited 41 states (18.2%)

Follow me on Strava