PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Static Methods

To make using the Ec2 class easier to use there are two static methods that can be invoked from any of the Ec2 Elements. The first static method is setKeys which will defind you AWS Access Keys as default keys. When you then create any new object you don't need to pass in any keys to the constructor.

Example 717. setKeys() Example

<?php
Zend_Service_Amazon_Ec2_Ebs
::setKeys('aws_key','aws_secret_key');

To set the region that you are working in you can call the setRegion to set which Amazon Ec2 Region you are working in. Currently there is only two region available us-east-1 and eu-west-1. If an invalid value is passed it will throw an exception stating that.

Example 718. setRegion() Example

<?php
Zend_Service_Amazon_Ec2_Ebs
::setRegion('us-east-1');

Set Amazon Ec2 Region

Alternativly you can set the region when you create each class as the third parameter in the constructor method.

Zend Framework