1
=========================
2
Bazaar Windows EC2 Server
3
=========================
5
We have an Amazon EC2 virtual machine called Desolation_ for
6
building Windows packages and general testing on Windows. As of
7
2009-02-19, this is just experimental and this is a draft specification,
8
but we aim to use it for the production Windows installer build of 1.13 in
13
* `Bazaar Developer Documentation Catalog <index.html>`_.
16
.. _Desolation: http://en.wikipedia.org/wiki/Desolation_Island
22
* The instance is only running (and incurring charges) when it's needed
23
for testing or packaging.
25
* It can be started or stopped by anyone on the team using a
26
straightforward script.
28
* Multiple people can get into the same instance at the same time, e.g.
29
if one person needs to pass work on to some one else.
31
* We keep snapshot of the OS and tool chain so that we can roll back if
34
* bzr branches and similar information are kept on stable storage that
35
survives rollbacks of the OS state, and that can be backed up.
37
Later on we may try automated Windows testing in a similar setup.
43
The working disk and the AMI images are stored in one person's account for
46
Ideally we want to give other people access to run this machine without
47
giving full access to the account. I'm not sure if that's feasible. If
48
it's not, we might need to allow people to launch the image within their
49
own account; this may be problematic if the shared volume is already in
52
I don't think it's possible to have an EBS that's shared across accounts,
53
and they can't be attached to multiple running instances. So for now it's
54
probably best to just ignore the concept and store the working data on the
55
instance's local storage, and to copy things up e.g. to Launchpad as
58
On this machine, ``C:`` should be used only for the Windows system files,
59
``D:`` for installed programs and working directories, and other drive
60
letters can be used later for mounting EBS storage if desired.
62
Through ``ec2-modify-image-attribute`` we can allow nominated users to
63
access an existing image. We need to have their AWS opaque ID.
65
Through ``ec2-bundle-image`` we can make a new snapshot at any point,
66
which will be stored into the current user's S3 account.
68
We'll (probably) have one shared account for running builds which is also
69
an administrator for ease of installing software.
71
You do need to have an RSA keypair to get the initial password for a
72
Windows machine, even though you can't use it to log in later.
73
``ec2-get-password`` takes the full path to the private key to obtain the
74
password from Amazon, and ``ec2-add-keypair`` creates a named keypair at
75
Amazon and returns the private path. One keypair is all that is needed.
76
This is distinct from the account identifier - likely due to the different
77
toolchains in use (the keypairs are used for unix SSH keys, and I (Robert)
78
suspect a rather unix friendly core at Amazon).
79
Once a custom image is made with a saved password, you can skip using
80
``ec2-get-password`` (which is only needed for Windows anyway).
82
It would be nice if rdesktop could use private key authentication but
85
Should check how the Launchpad ec2test scripts work.
95
* Be in the bzr core team. If you are interested in helping with
96
Windows packaging, testing or development just ask.
99
`Amazon EC2 API tools`_ (needs-packaging `bug 330930`_)
101
* Create an Amazon Web Services account, sign up for S3 and EC2, and do
102
the various steps to create authentication devices.
104
* Create a private key and certificate for yourself.
105
Check these environment variables are set and exported, e.g. by setting
106
them in the file ``~/.aws``. Make sure the files are private.::
108
export EC2_PRIVATE_KEY=~/.ec2/pk-XXXXXX.pem
109
export EC2_CERT=~/.ec2/cert-XXXXXX.pem
110
export EC2_HOME=~/build/ec2-api-tools-1.3-30349
111
export AWS_SECRET_ACCESS_KEY=XXXXXXXXX
112
export AWS_ACCESS_KEY_ID=XXXXXXXXXXX
113
export EC2_KEYPAIR_NAME=XXXXXXXXX
114
export PATH=$PATH:$EC2_HOME/bin
115
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
116
ssh-add ~/.ec2/id_rsa
118
You can now '. ~/.aws' to get the ec2 commands available.
120
* (Unix images only) run ec2-add-keypair SOMENAME, e.g. 'bzr'. Put the
121
result (minus the first line) somewhere like ~/.ec2/id_rsa and chmod go-rw.
123
* A useful Unix image is `ami-bdfe19d4`_, Eric Hammonds 64-bit Ubuntu image.
125
* Install the rdesktop client, to actually access the machine.
127
* Possibly read some of the `EC2 documentation`_ for background.
129
.. _`bug 330930`: https://bugs.launchpad.net/ubuntu/+bug/330930
130
.. _`Amazon EC2 API tools`:
131
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=368&categoryID=88
132
.. _`EC2 documentation`: http://aws.amazon.com/
134
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1762&categoryID=101
136
* Create a security group for your that allows rdesktop access and icmp with::
138
ec2-add-group desolation-group -d 'bzr win32 build machine'
139
ec2-authorize desolation-group -p 3389 -s 1.2.3.4/32
140
ec2-authorize desolation-group -t -1:-1 -P icmp
142
Add your public IP there. You can repeat that command to allow others
146
To start up an instance
147
-----------------------
149
1. Get the right AMI image ID from another developer.
151
1. Start the instance::
153
ec2-run-instances $image_id -g desolation-group
155
This will print out some information including the image id, something
158
1. Actually starting the machine will take a few minutes. Once it's in
159
the *running* state, get the machine's public IP with ::
161
ec2-describe-instances
163
1. and then connect ::
165
rdesktop -g 1200x850 -u Administrator $machine_ip
167
Don't forget to shut it down when you're done, and check with
168
``ec2-describe-instances`` that it did terminate.
171
To save a system snapshot as an image
172
-------------------------------------
174
1. Bundle the current state. *Doing this will reboot the machine.*
175
You need to choose a unique s3 bucket name,
176
typically based on a domain or email address, which can contain
177
any number of images. You also need a name unique within the bucket
178
for this image, like ``desolation-vs2008-20090219``. And finally
179
it needs your AWS S3 access key and secret key, which should be set in
182
ec2-bundle-instance -b ec2.sourcefrog.net \
183
-p desolation-vs2008-2009021 \
184
-o "$AWS_ACCESS_KEY_ID" \
185
-w "$AWS_SECRET_ACCESS_KEY"
187
1. This will take several minutes: You can check progress with ::
189
ec2-describe-bundle-tasks
191
1. Register the files as an image, e.g.::
193
ec2-register ec2.sourcefrog.net/desolation-vs2008-2009021
195
This will give you an AMI id for the image.
197
1. Give access to other team members identified by their Amazon account id::
199
ec2-modify-image-attributes $ami_id -l -a 123412341234
202
Management console (useful!)
203
----------------------------
205
https://console.aws.amazon.com/ec2/home