diff --git a/README.md b/README.md index df4af6c..af53141 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,22 @@ Using the native OpenStack Dashboard or APIs you would be able to manage the EC2 - VirtualBox - Vagrant -###Instructions +###Instructions for Developer environment 1. Clone this repository: `git clone https://github.com/ThoughtWorksInc/OpenStack-EC2-Driver.git` 2. Run`vagrant up` from within the repository to create an Ubuntu virtualbox that will install devstack. This will take a couple minutes. 3. `vagrant ssh` to ssh into the new machine 4. Use `vim /etc/nova/nova.conf` to edit the nova configuration so that - - the compute_driver is set to ec2.EC2Driver - - under the [conductor] section, add the following line - use_local = True + + [DEFAULT] + compute_driver=ec2.EC2Driver + + [conductor] + use_local=True + + [ec2driver] + ec2_secret_access_key = + ec2_access_key_id = + 5. Restart nova - `~/devstack/rejoin-stack.sh` - go to the nova-cpu screen (`ctrl+a`, `6`) diff --git a/ec2driver.py b/ec2driver.py index ff52b72..ada1465 100644 --- a/ec2driver.py +++ b/ec2driver.py @@ -67,6 +67,10 @@ ec2driver_opts = [ cfg.BoolOpt('use_linked_clone', default=True, help='Whether to use linked clone'), + cfg.StrOpt('ec2_secret_access_key', + help='The secret access key of the Amazon Web Services account'), + cfg.StrOpt('ec2_access_key_id', + help='The access key ID of the Amazon Web Services account'), ] CONF = cfg.CONF @@ -140,17 +144,16 @@ class EC2Driver(driver.ComputeDriver): self.creds = get_nova_creds() self.nova = client.Client(**self.creds) - region = RegionInfo(name=aws_region, endpoint=aws_endpoint) - self.ec2_conn = ec2.EC2Connection(aws_access_key_id=aws_access_key_id, - aws_secret_access_key=aws_secret_access_key, + self.ec2_conn = ec2.EC2Connection(aws_access_key_id=CONF.ec2driver.ec2_access_key_id, + aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key, host=host, port=port, region=region, is_secure=secure) self.cloudwatch_conn = ec2.cloudwatch.connect_to_region( - aws_region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) + aws_region, aws_access_key_id=CONF.ec2driver.ec2_access_key_id, aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key) self.security_group_lock = Lock() self.rule_comparator = rule_comparator.RuleComparator(self.ec2_conn) diff --git a/ec2driver_standard_config.py b/ec2driver_standard_config.py index 984e425..1606d84 100644 --- a/ec2driver_standard_config.py +++ b/ec2driver_standard_config.py @@ -18,8 +18,6 @@ from collections import defaultdict aws_region = 'us-east-1' aws_endpoint = 'ec2.us-east-1.amazonaws.com' -aws_access_key_id = 'AKIAIZJDDRNNJUWZ3LXA' -aws_secret_access_key = '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' port = 443 host = str(port) + ":" + aws_endpoint secure = True