Create Table If Not Exists Hanging
I find this troubling for two reasons
REASON #1
This could be a bug that never got squashed out of MySQL 5.5.17

Nov 08, 2011 : http://bugs.mysql.com/bug.php?id=63144 (Status is Needs Triage on MySQL 5.5.17)
Mar 21, 2011 : http://bugs.mysql.com/bug.php?id=60563 (MySQL 5.5.10)
Jun 23, 2006 : http://bugs.mysql.com/bug.php?id=20662

REASON #2
You are trying to acquire a metadata lock on an InnoDB table in an RDS environment? Ouch !!!
Possible Workaround
Instead of trusting the metadata locking in RDS, ask the information_schema if the table exists already. Suppose the table is mydb.backupfiles. Run this query:
SELECT COUNT(1) FROM information_schema.tables
WHERE table_schema='mydb' AND table_name='backupfiles';

If the answer comes back 0, run CREATE TABLE backupfiles .... Otherwise, don't run it.
Possible Solution
Upgrade to the Latest MySQL (5.6.12) or the Latest MySQL5.5 (5.5.31). Hopefully, this issue was solved in a more recent version
Give it a Try !!!
UPDATE 2013-07-11 15:16 EDT
Here is a rewrite of your bash code to check if the table already exists
    echo &quot;CREATE DATABASE IF NOT EXISTS $DATABASE;&quot; &gt; /tmp/runthis.sql
    echo &quot;use $DATABASE;&quot; &gt;&gt; /tmp/runthis.sql
    SQLSTMT=&quot;SELECT COUNT(1) FROM information_schema.tables&quot;
    SQLSTMT=&quot;${SQLSTMT} WHERE table_schema='${DATABASE}' AND table_name='backupfiles';&quot;
    TABLE_EXISTS=`mysql -h portal-rds -u $user --password=$mysqlpw -ANe&quot;${SQLSTMT}&quot;`
    if [[ ${TABLE_EXISTS} -eq 0 ]]; then
      SQLSTMT=&quot;CREATE TABLE backupfiles (fileName VARCHAR(20),&quot;
      SQLSTMT=&quot;${SQLSTMT} archiveId VARCHAR(500), checkSum VARCHAR(100),&quot;
      SQLSTMT=&quot;${SQLSTMT} glacierVault VARCHAR(100), timeStamp date);&quot;
      echo &quot;${SQLSTMT}&quot; &gt;&gt; /tmp/runthis.sql
    fi
    SQLSTMT=&quot;INSERT INTO backupfiles VALUES ('$archive_file_name',&quot;
    SQLSTMT=&quot;${SQLSTMT} '$archiveID', '$CURRENTVAULT', '$checkSum', CURDATE());&quot;
    echo &quot;${SQLSTMT}&quot; &gt;&gt; /tmp/runthis.sql
    echo &quot;COMMIT;&quot; &gt;&gt; /tmp/runthis.sql
    mysql -h portal-rds -u $user --password=$mysqlpw &lt; /tmp/runthis.sql