| 131 | |
| 132 | == Setup Environment Variables == |
| 133 | |
| 134 | |
| 135 | Step 5: Setup environment variables |
| 136 | ------------------------------------ |
| 137 | |
| 138 | {{{ |
| 139 | cd ~/Tutorials/DiCloud |
| 140 | nano environment |
| 141 | |
| 142 | [ Insert correct from geni_aws_credentials.txt |
| 143 | AWS_ACCESS_KEY_ID= |
| 144 | AWS_SECRET_ACCESS_KEY= ] |
| 145 | |
| 146 | cat environment >> ~/.bashrc |
| 147 | }}} |
| 148 | |
| 149 | Add Access Key Id and Secret Access Key to .s3cfg file. |
| 150 | Copy .s3cfg file to ~geni |
| 151 | |
| 152 | {{{ |
| 153 | cp ~/Tutorials/DiCloud/.s3cfg ~/.s3cfg |
| 154 | }}} |
| 155 | |
| 156 | |
| 157 | == Run the DiCloud server == |
| 158 | |
| 159 | {{{ |
| 160 | cd ~/Tutorials/DiCloud/dicloud/bin |
| 161 | ./dicloud_server.sh |
| 162 | }}} |
| 163 | |
| 164 | |
| 165 | Step 7: Using the DiCloud console |
| 166 | --------------------------------- |
| 167 | |
| 168 | Open a new terminal. We run ntpdate to make sure the time is accurate. Amazon will fail calls from machines with inaccurate local time. |
| 169 | |
| 170 | {{{ |
| 171 | sudo ntpdate ntp.ubuntu.com |
| 172 | cd ~/Tutorials/DiCloud/dicloud/bin |
| 173 | ./dicloud_console.sh |
| 174 | dicloud - not connected>connect localhost 1099 |
| 175 | Connecting to //localhost:1099/dicloud/server |
| 176 | dicloud - //localhost:1099>ec2 start /home/geni/Tutorials/DiCloud/ec2/keys/geni_cert$ |
| 177 | dicloud - //localhost:1099>help |
| 178 | Commands available for the main menu are: |
| 179 | add credit amount_of_money |
| 180 | Add credit to the AWS account |
| 181 | billing history history_size csv|html |
| 182 | Get the AWS account activity history in CSV or HTML format (a history of 0 retrie$ |
| 183 | connect DiCloudServerHostName RmiPortNumber |
| 184 | Connects to the DiCloud server |
| 185 | ebs attach cert.pem pk.pem ec2_region ebs_volume_id ec2_instance_id device_name |
| 186 | Attach an EBS volume (ebs_volume_id) to the running instance (ec2_instance_id) as$ |
| 187 | ebs create cert.pem pk.pem size_in_gb ec2_region ec2_availability_zone |
| 188 | Create an EBS volume |
| 189 | ebs delete cert.pem pk.pem volume_id ec2_region |
| 190 | Delete an EBS volume |
| 191 | ebs detach cert.pem pk.pem ec2_region ebs_volume_id |
| 192 | Detach EBS volume ebs_volume_id from its EC2 instance |
| 193 | ebs probe cert.pem pk.pem volume_id ec2_region ascii|html |
| 194 | Probe an EBS volume and get current status information |
| 195 | ec2 probe cert.pem pk.pem instance_id ec2_region html|ascii |
| 196 | Check the status of a running EC2 instance |
| 197 | ec2 start cert.pem pk.pem ami_id instance_nb instance_type ec2_region ec2_keypair_na$ |
| 198 | Start a new EC2 instance |
| 199 | ec2 stop cert.pem pk.pem instance_id ec2_region ec2_keypair_name |
| 200 | Stop an EC2 instance |
| 201 | get balance |
| 202 | Get the AWS account balance |
| 203 | help |
| 204 | Print this help message |
| 205 | history [<command index>] |
| 206 | Display history of commands for the console. |
| 207 | quit |
| 208 | Quit the console |
| 209 | s3 create bucket_name region |
| 210 | Create an S3 bucket |
| 211 | s3 delete bucket_name region |
| 212 | Delete an S3 bucket |
| 213 | s3 get s3_bucket_name object_name file_path |
| 214 | Get the content of an object named object_name into the specified file from the S$ |
| 215 | s3 probe bucket_name region |
| 216 | Get information about an S3 bucket |
| 217 | s3 put s3_bucket_name object_name file_path |
| 218 | Put the content of the specified file in an object named object_name in the S3 bu$ |
| 219 | shutdown |
| 220 | Shutdown the DiCloud server the console is currently connected to. |
| 221 | dicloud - //localhost:1099>get balance |
| 222 | Current balance is: $99.53222835338767 |
| 223 | dicloud - //localhost:1099>ec2 probe /home/geni/Tutorials/DiCloud/ec2/keys/geni_cert.pem /home/geni/Tutorials/DiCloud/ec2/keys/geni_pk.pem i-b87b74d8 us-east-1 ascii |
| 224 | Instance Id: i-b87b74d8 |
| 225 | AMI Id: ami-78f21911 |
| 226 | Public name: ec2-75-101-245-135.compute-1.amazonaws.com |
| 227 | Private name: ip-10-244-46-161.ec2.internal |
| 228 | Public IP: 75.101.245.135 |
| 229 | Private IP: 10.244.46.161 |
| 230 | Instance State: running |
| 231 | Instance Type: m1.small |
| 232 | Key pair: geni-keypair |
| 233 | Start time: 2011-10-17T17:31:41+0000 |
| 234 | Availability zone: us-east-1b |
| 235 | dicloud - //localhost:1099>quit |
| 236 | }}} |
| 237 | |
| 238 | You can also script the DiCloud console. An example is below. |
| 239 | |
| 240 | {{{ |
| 241 | $ echo "connect localhost 1099 |
| 242 | get balance |
| 243 | quit" > ./getbalance.txt |
| 244 | $ ./dicloud_console_script.sh -silent < ./getbalance.txt |
| 245 | }}} |
| 246 | |
| 247 | Example use of S3 |
| 248 | |
| 249 | {{{ |
| 250 | dicloud - //localhost:1099>s3 create gec12-tutorial-1 us |
| 251 | dicloud - //localhost:1099>s3 put gec12-tutorial-1 test /home/geni/Tutorials/DiCloud/dicloud/bin/dicloud.properties |
| 252 | Uploading file /home/geni/Tutorials/DiCloud/dicloud/bin/dicloud.properties as object test in bucket gec12-tutorial-1 |
| 253 | dicloud - //localhost:1099>s3 get gec12-tutorial-1 test /home/geni/Tutorials/DiCloud/test |
| 254 | Downloading file /home/geni/Tutorials/DiCloud/test from object test in bucket gec12-tutorial-1dicloud - //localhost:1099> |
| 255 | dicloud - //localhost:1099>s3 delete gec12-tutorial-1 us |
| 256 | }}} |
| 257 | |
| 258 | Example use of EBS |
| 259 | {{{ |
| 260 | dicloud - //localhost:1099>ebs create /home/geni/Tutorials/DiCloud/ec2/keys/geni_cert.pem /home/geni/Tutorials/DiCloud/ec2/keys/geni_pk.pem 1 us-east us-east-1a |
| 261 | dicloud - //localhost:1099>ebs delete /home/geni/Tutorials/DiCloud/ec2/keys/geni_cert.pem /home/geni/Tutorials/DiCloud/ec2/keys/geni_pk.pem <volume_id> us-east |
| 262 | }}} |
| 263 | |