Results 1 to 2 of 2

Thread: control a Wowza EC2 Server via Amazon SDK / PHP

  1. #1

    Default control a Wowza EC2 Server via Amazon SDK / PHP

    Hi,

    I want to use Amazon SDK for PHP, to control the launch of an instance Wowza on EC2.
    I can not find the way to pass as parameter, the name of the startup file package, as I can tell the name of the AMI or instance type like :

    $ec2 = new AmazonEC2();
    $response = $ec2->run_instances('ami-xxxxxxxx', 1, 1, array('InstanceType' => 'm1.small'));

    How do I indicate that I want to pass the file name of the startup package as parameter ?

    Thank you for your help.
    Best regards,
    Gerard

  2. #2

    Default

    I found the solution :

    Send the variable $userdata in the options :

    $user_data = file2base64('my_startup_package.zip');
    $image_id = 'ami-8fa19afb'; //instance linux wowza m1.small
    $min = 1; //the minimum number of instances to start
    $max = 1; //the maximum number of instances to start
    $options = array(
    'SecurityGroup' => 'default', //replace with your security group id
    'InstanceType' => 'm1.small',
    'KeyName' => 'my_keyname',
    'UserData' => $user_data
    );
    $response = $ec2->run_instances($image_id, $min, $max, $options);


    // function which convert the file
    function file2base64($source) {
    $bin_data_source = fread(fopen($source, "r"), filesize($source)); // reading as binary string
    $b64_data_source = base64_encode($bin_data_source); // BASE64 encodage
    return $b64_data_source;
    }

    et hop ..
    Last edited by gerard; 09-30-2012 at 04:00 AM.

Similar Threads

  1. Error while using new amazon ec2 control pannel
    By hbgroup in forum General Forum
    Replies: 6
    Last Post: 10-15-2013, 03:40 PM
  2. Amazon EC2 Server (running Wowza Media Server 3), Adobe FMLE (3 bitrates), JW Player
    By maurolopes in forum Wowza Media Server 3 for Amazon EC2 Discussion
    Replies: 1
    Last Post: 08-26-2013, 08:24 AM
  3. Looking for best practice for Wowza Media Server 3 and Amazon EC2
    By yaving in forum Wowza Media Server 3 for Amazon EC2 Discussion
    Replies: 6
    Last Post: 05-28-2012, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •