Categories
Geek Speak

AWS Elastic Beanstalk

I learned something interesting yesterday trying to create an updated an Elastic Beanstalk environment.

ENVIRONMENT PROPERTIES CAN ONLY CONTAIN –

[A-Z_][A-Z0-9_] _ . : / = + \ – @ ‘ ” Single and double quotation marks in values must be escaped. (=DON’T USE.)

EB Environment, Configuration, Server will except accept illegal characters.

The script that exports the properties to env variables will fail silently, yielding no values in printenv versus eb printenv.

Sixteen hours later. The AWS documentation is right, the configuration page needs a little UI work.

Here is my solution to the problem –

!/bin/bash

#AWS Compatible Salt Shaker

#use awscss.sh number_of_strings length_of_strings

if [ $# -lt 2 ]; then
echo “Use – awscss.sh number_of_strings length_of_strings”
echo “For wordpress use – awscss.sh 8 64”
exit
fi

allowableCharacters=’abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_.:/=+-@’

#loop through the number of random strings to generate

for ((i=1; i<=$1; i++))
do
randomString=()
# loop through the length of the random string
for ((j=1; j<=$2; j++ ))
do
randomNumber=$((0 + RANDOM % 71))
# do something ${string:position:length}
randomString+=${allowableCharacters:$randomNumber:1}
done
echo $i ${randomString[@]}
done

Leave a Reply