{"id":298,"date":"2015-12-03T09:34:01","date_gmt":"2015-12-03T09:34:01","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=298"},"modified":"2015-12-03T09:34:01","modified_gmt":"2015-12-03T09:34:01","slug":"298","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2015\/12\/03\/298\/","title":{"rendered":"Enable Rackspace Cloud Database root user (Script\/Wizard for API)"},"content":{"rendered":"<p>I have noticed that we get quite a few customers asking how to enable root user in the Rackspace cloud database product. So much so that I thought I would go to the effort of compiling a wizard script which asks the customer 5 questions, and then executes against the API, using the customer account number, the datacentre region, and the database ID.<\/p>\n<p>To Install and Run the script you only need to do:<\/p>\n<p>curl -s -o \/tmp\/1.sh http:\/\/adam.haxed.me.uk\/db-root-enable.sh &#038;&#038; bash \/tmp\/1.sh<\/p>\n<p><a href=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM.png\" alt=\"Screen Shot 2015-12-03 at 9.33.17 AM\" width=\"1306\" height=\"197\" class=\"alignnone size-full wp-image-299\" srcset=\"https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM.png 1306w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM-300x45.png 300w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM-1024x154.png 1024w, https:\/\/haxed.me.uk\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-9.33.17-AM-500x75.png 500w\" sizes=\"auto, (max-width: 1306px) 100vw, 1306px\" \/><\/a><\/p>\n<p>However I have included the script source code underneath for reference. This has been tested and works.<\/p>\n<p>Script Code:<\/p>\n<p>#!\/bin\/bash<br \/>\n# Enable root dbaas user access<br \/>\n# User Alterable variables<br \/>\n# Author: Adam Bull<br \/>\n# Date: Monday, November 30 2015<br \/>\n# Company: Rackspace UK Server Hosting<\/p>\n<p># ACCOUNTID forms part of your control panel login; https:\/\/mycloud.rackspace.co.uk\/cloud\/1001111\/database#rax%3Adatabase%2CcloudDatabases%2CLON\/321738d5-1b20-4b0f-ad43-ded24f4b3655<\/p>\n<p>echo &#8220;Enter your Account (DDI) this is the number which forms part of your control panel login e.g. https:\/\/mycloud.rackspace.co.uk\/cloud\/1001111\/&#8221;<br \/>\nread ACCOUNTID<\/p>\n<p>echo &#8220;Enter your Database ID, this is the number which forms part of your control panel login when browsing the database instance e.g. https:\/\/mycloud.rackspace.co.uk\/cloud\/1001111\/database#rax%3Adatabase%2CcloudDatabases%2CLON\/242738d5-1b20-4b0f-ad43-ded24f4b3655&#8221;<br \/>\nread DATABASEID<\/p>\n<p>echo &#8220;Enter what Region your database is in i.e. lon, dfw, ord, iad, syd, etc&#8221;<br \/>\nread REGION<\/p>\n<p>echo &#8220;Enter your customer username login (visible from account settings page)&#8221;<br \/>\nread USERNAME<\/p>\n<p>echo &#8220;Enter your customer apikey (visible from account settings page)&#8221;<br \/>\nread APIKEY<\/p>\n<p>echo &#8220;$USERNAME $APIKEY&#8221;<\/p>\n<p>TOKEN=`curl https:\/\/identity.api.rackspacecloud.com\/v2.0\/tokens -X POST -d &#8216;{ &#8220;auth&#8221;:{&#8220;RAX-KSKEY:apiKeyCredentials&#8221;: { &#8220;username&#8221;:&#8221;&#8216;$USERNAME'&#8221;, &#8220;apiKey&#8221;: &#8220;&#8216;$APIKEY'&#8221; }} }&#8217; -H &#8220;Content-type: application\/json&#8221; |  python -mjson.tool | grep -A5 token | grep id | cut -d &#8216;&#8221;&#8216; -f4`<\/p>\n<p>echo &#8220;Enabling root access for instance $DATABASEID&#8230;see below for credentials&#8221;<br \/>\n# Enable the root user for instance id<br \/>\ncurl -X POST -i \\<br \/>\n-H &#8220;X-Auth-Token: $TOKEN&#8221; \\<br \/>\n-H &#8216;Content-Type: application\/json&#8217; \\<br \/>\n&#8220;https:\/\/$REGION.databases.api.rackspacecloud.com\/v1.0\/$ACCOUNTID\/instances\/$DATABASEID\/root&#8221;<\/p>\n<p># Confirm root user added<br \/>\ncurl -i \\<br \/>\n-H &#8220;X-Auth-Token: $TOKEN&#8221; \\<br \/>\n-H &#8216;Content-Type: application\/json&#8217; \\<br \/>\n&#8220;https:\/\/$REGION.databases.api.rackspacecloud.com\/v1.0\/$ACCOUNTID\/instances\/$DATABASEID\/root&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have noticed that we get quite a few customers asking how to enable root user in the Rackspace cloud database product. So much so that I thought I would go to the effort of compiling a wizard script which &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2015\/12\/03\/298\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,15,2],"tags":[],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-api","category-cloud","category-mysql"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":1,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":300,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/298\/revisions\/300"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}