TurnKey Linux Virtual Appliance Library

Migrate Turnkey AMI to another AWS account

Tim Collins's picture

OK so I've got a configured Turnkey machine image I used to demo to a customer. Now the customer wants to go live with it but move it or copy it rather under their own AWS account login.

How should I do this or what's the best way?

Thanks.

Jeremy's picture

Not sure if it's the best way...

But one way you could do it is do a TKLBAM backup of your prototype machine. Then get the customer to fire up the base image under their AWS/Hub account and give you root access. Then restore your backup to new machine on the customer's AWS/Hub account. Once you are happy that it is all functioning as it should, unlink it from your TKLBAM/Hub account (ie remove your Hub API key). If your customer is keen, you could finalise by linking the machine to their TKLBAM/Hub account (for automated backups).

Liraz Siri's picture

Ah, you beat to it again! :)

Ah, you beat to it again! :)

How to unlink the API key ?

Hi Jed,

sorry to dig up an old post but I'm looking for a solution to my problem and this is the closest info I managed to find.

My scenario is similar to the original poster.
In my case I had to install a Redmine appliance in a VM on my computer at work for the project I was working on and linked TKLBAM to my personal HUB account.
Now that my job is finished, the client would like to keep the appliance (lots of project related info is stored there) but I don't want to keep paying for the backups and I don't want to risk having them reactivate the backup through my Hub account.

So my question is, how can I unlink the machine from my TKL Hub account?
I looked everywhere and I didn't find an option to remove/change the API key.
All I can see is a "cancel account" in my Hub profile but that would be a bit extreme I think.

Thanks in advance for your help

Jeremy's picture

Good Question

And to be completely honest I'm not 100% sure. I know it can work in theory but haven't ever done it myself. You should be able to replace your API key with theres using the --force switch with tklbam-init but I'm not sure if you can use that to just remove your key (without adding a new one). eg

tklbam-init --force

Perhaps you could just remove tklbam (and purge data) and then reinstall it?

apt-get remove --purge tklbam
apt-get install tklbam

Jeremy, thanks for your help

Jeremy, thanks for your help but unfortunately none of the suggested options worked.

The tklbam-init commands expects a valid API key and the link was preserved after removing and re-installing tklbam through apt-get.

It seems like the only options left is to either close my hub account (and cancel it on AWS) or to ask the client to create an account of their own and set it up on the machine.

As a suggestion to the devs, maybe they could implement something to be able to unlink the machine from the Hub. Similar to how you can unlink Google authentication to an application from your Google account.

 I should of thought about that a bit sooner. I really was expecting to be able to manage that kind of scenario directly from the Hub.

Anyway, thanks again.

Jeremy's picture

Sorry I couldn't help

We really need one of the devs to give us some pointers.

In the meantime perhaps you could investigate the tklbam-init script to see where it is storing the API key and manually remove it from whatever config file it is using?

Jeremy's picture

Here you go!

To reset the initialisation of TKLBAM, remove the encrypted local copy of the Hub API key. It's stored in /var/lib/tklbam so this should reset TKLBAM:

rm -rf /var/lib/tklbam

Thank you Jeremy!

I tested it on a local VM and it worked.

Unfortunately I don't have access to the client's VM anymore. I sent them the info and hopefully they'll run it so I don't get any surprises in the future.

I still think it would be better if we could control that aspect directly through the hub. It would be a great feature to add if it's technically possible.

Anyway, thanks again for you help.

L. Arnold's picture

Should there also be any Rinstallation of tklbam itself?

I am copying via VMware a VM to a new system that I want to then morph.  It should have its own backup set. 

Should any of these commands also be used to get a "fresh tklbam" set going?

You referenced above the following

tklbam-init --force

Perhaps you could just remove tklbam (and purge data) and then reinstall it?

apt-get remove --purge tklbam
apt-get install tklbam

L. Arnold's picture

Seemed to work, in this order

This became a VMWare subject for me rather than a AMI/AWS issue, but none the less.

This worked for me just now (following your great tips!)
----
Clone the new Machine
Assign IP at Startup
_______

Log into Webshell

rm -rf /var/lib/tklbam
apt-get remove --purge tklbam
apt-get install tklbam
tklbam-init --force
(now will make its own Tklbam backup sets)
__________
Log into (in my case) Joomla Admin (main site would not load)
Give the correct URL in Global Configuration
Clear Cache
Clear Cache again
(now the Site actually Loads)
____________
new Web Server fully built with other content...  Time to change content.
Functional approach when tklbam won't make the move...
Using other approaches w/ TKLBAM and Migrating SQL Files I kept loosing my Boot Screen after a few cycles.
We should be good to go now


Works a treat

Cheers Jeremy for this post, the command below works a treat

rm -rf /var/lib/tklbam

L. Arnold's picture

Another Idea... Make a Patch of the system then install the ISO

I believe you could make a Patch of the system running and end up with an ISO that could be installed as TKLBAM is likewise used to Restore.

The variable might be the Database initializations after xyz customizations.

I have been meaing to try this myself.  Unfortunately, the Upgradability at a later date would require maintaining your own Patch string, but perhaps you could use the base image (like lamp, lapp or core etc) and running a tklbam-restore over it.

Worst thing that could happen is failure.  Probably not catastrophic failure if you have the original patch to start with again.  TKLBAM restore "should" restore back to last good point (lapp excluded)...  (snapshots as well could provide this security, either in the VM system or on the Hub)

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)