Changes

From Genome Analysis Wiki
Jump to navigationJump to search
Line 7: Line 7:  
These notes assume you have already created an EC2 account and have the certificates and keys set up properly.
 
These notes assume you have already created an EC2 account and have the certificates and keys set up properly.
   −
== Launch an instance ==
+
 
 +
== Create new GotCloud AMI from StarCluster AMI ==
 +
=== Launch an instance ===
    
<code>
 
<code>
Line 34: Line 36:  
# Select the key/pair you want to use & Launch
 
# Select the key/pair you want to use & Launch
   −
== Setup the instance with GotCloud ==
+
=== Setup the instance with GotCloud ===
 
This assumes you have already logged onto the instance.
 
This assumes you have already logged onto the instance.
   Line 60: Line 62:  
#* <code>:q</code>
 
#* <code>:q</code>
   −
== Create the AMI ==
+
=== Set Up Swap Space ===
 +
 
 +
Issue the command '''swapon -s''' to see if there is swap space.
 +
If there is only a header line, you need to add a swap file like this:
   −
Once your instance is all ready with everything you want, create the AMI.
+
<code>
 +
  df -h          # Be sure there's enough space, decide on swap size
 +
  #  Create a file /swap to use (assuming / is large enough)
 +
  sudo bash      # Run these commands as root
 +
  swap=/swap
 +
  dd if=/dev/zero of=$swap bs=524288 count=16384    # 8GB swap on t1.micro  15G=bs=1073741824 count=15
 +
  chown root:root $swap
 +
  mkswap $swap
 +
  chmod 0600 $swap
 +
  swapon $swap
 +
  echo "$swap  none swap sw  0  0" >> /etc/fstab
 +
 +
  swapon -s      # Should show the swap device
 +
</code>
   −
In your browser at the EC2 Management Console do the following:
+
=== Cleanup the instance for creating an AMI ===
# Select the running instance
+
# Go to : [[#Cleanup Instance for AMI Creation|Cleanup Instance for AMI Creation]]
# Right click, <code>Create Image</code>
  −
# Enter name & Description
  −
# Ensure volume size is correct
  −
# Mark delete on terminate
  −
#:This will take several minutes to complete.
  −
#:In the EC2 Dashboard, you can monitor the progress.
  −
#:When it is done, you'll see a new AMI under the list of AMIs.
  −
# When completed, terminate your old instance
     −
Your new AMI should look pretty much like this:
+
=== Create the AMI ===
 +
# Go to : [[#Create the AMI|Create the AMI]]
      Line 88: Line 99:  
#* Specify <code>-j #</code> based on the number of CPUs your instance has
 
#* Specify <code>-j #</code> based on the number of CPUs your instance has
 
# <code>cd</code>
 
# <code>cd</code>
 +
# Go to : [[#Create the AMI|Create the AMI]]
 +
 +
 +
==Cleanup Instance for AMI Creation==
 +
First time from generic/starcluster AMI
 +
# Disable password-based logins for root
 +
## Open /etc/ssh/sshd_config
 +
## Change <code>PermitRootLogin yes</code> to <code>PermitRootLogin without-password</code>
 +
# Disable root access
 +
## <code> sudo passwd -l root</code>
 +
 +
 +
Each time we generate a new AMI, run:
 +
<pre>sudo shred -u /etc/ssh/*_key /etc/ssh/*_key.pub
 +
sudo find / -name "authorized_keys" -exec rm -f {} \;
 +
rm -rf ~/.ssh
 +
shred -u ~/.*history
 +
sudo find /root/.*history /home/*/.*history -exec rm -f {} \;
 +
history -w
 +
history -c
 +
</pre>
 +
These commands do the following:
 +
# Remove SSH host key pairs
 +
# Remove SSH authorized keys
 +
# Remove ssh
 +
# Delete shell history
    +
== Create the AMI ==
   −
== Set Up Swap Space ==
+
Once your instance is all ready with everything you want, create the AMI.
   −
Issue the command '''swapon -s''' to see if there is swap space.
+
In your browser at the EC2 Management Console do the following:
If there is only a header line, you need to add a swap file like this:
+
# Select the running instance
 +
# Right click, <code>Create Image</code>
 +
# Enter name & Description
 +
# Ensure volume size is correct
 +
# Mark delete on terminate
 +
#:This will take several minutes to complete.
 +
#:In the EC2 Dashboard, you can monitor the progress.
 +
#:When it is done, you'll see a new AMI under the list of AMIs.
 +
# When completed, terminate your old instance
   −
<code>
  −
  df -h          # Be sure there's enough space, decide on swap size
  −
  #  Create a file /swap to use (assuming / is large enough)
  −
  sudo bash      # Run these commands as root
  −
  swap=/swap
  −
  dd if=/dev/zero of=$swap bs=524288 count=16384    # 8GB swap on t1.micro  15G=bs=1073741824 count=15
  −
  chown root:root $swap
  −
  mkswap $swap
  −
  chmod 0600 $swap
  −
  swapon $swap
  −
  echo "$swap  none swap sw  0  0" >> /etc/fstab
  −
  −
  swapon -s      # Should show the swap device
  −
</code>
     −
== Install the Software ==
+
== Older/Additional Instructions ==
 +
=== Install the Software ===
    
'''(1)''' There are a number of additional Debian packages that you may well need, so we make
 
'''(1)''' There are a number of additional Debian packages that you may well need, so we make
Line 189: Line 222:  
Run the tests to be sure everything is OK.
 
Run the tests to be sure everything is OK.
   −
== Configure the Host to be Usable ==
+
=== Configure the Host to be Usable ===
    
It is useful to configure /etc/rc.local to do most things you need at boot time.
 
It is useful to configure /etc/rc.local to do most things you need at boot time.
Line 273: Line 306:  
</code>
 
</code>
   −
== Test the new AMI ==
+
=== Test the new AMI ===
    
Launch a new AMI instance and check that files are in the correct places.
 
Launch a new AMI instance and check that files are in the correct places.

Navigation menu