|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
This version of the AWS SDK for PHP is deprecated and is only provided to support legacy applications. All new code should use the current version of the SDK at http://aws.amazon.com/sdkforphp/.
You will need an Amazon EC2 client in order to create security groups and key pairs, and start Amazon EC2
instances. Before configuring your client, you must create a PHP file named
store your AWS Access Key and your Secret Key. This PHP file must be placed in the same parent directory as your PHP
The file looks like this:
<?php if (!class_exists('CFRuntime')) die('No direct access allowed.'); CFCredentials::set(array( '@default' => array( 'key' => 'MyAccessKey', 'secret' => 'MySecretKey', 'default_cache_config' => 'C:\wamp\www', 'certificate_authority' => true ) ));>
You must provide your AWS security credentials, the path to your local PHP cache, and a
certificate_authority value of
false. Other configuration values can
be optionally defined. As an example to follow, use the
config-sample.inc.php file in the same
directory as your configuration file.
To learn more about your AWS credentials, including where to find them, go to About AWS Security Credentials.
After you create this file, you are ready to create and initialize your Amazon EC2 client.
To create and initialize an Amazon EC2 client
Create and initialize an AmazonEC2 instance, as follows:
$ec2 = new AmazonEC2();
By default, the service endpoint is
ec2.us-east-1.amazonaws.com. For a list of Amazon EC2
service endpoints, go to Regions and
Before running an Amazon EC2 instance, you will need to create a Amazon EC2 security group, authorize security group ingress, and create a key pair to allow you to log into your instance.
For information about creating a security group, see Create an Amazon EC2 Security Group.
For information about authorizing security group ingress, see Authorize Amazon EC2 Security Group Ingress.
For information about creating a key pair, see Create a Key Pair.
For information about running your Amazon EC2 instance, see Run an Amazon EC2 Instance.