Manage cloud infrastructures using Zend Framework 2 (and ZF1)

Enrico Zimuel
Enrico ZimuelSenior Software Engineer at Zend Technologies
Enrico Zimuel
Zend Technologies

Manage Cloud
Infrastructures in PHP using
Zend Framework 2 (and ZF1)
About me
           • Software Engineer since 1996
             – Assembly x86, C/C++, Java, Perl, PHP
           • Enjoying PHP since 1999
           • PHP Engineer at Zend since 2008
           • ZF Core Team from April 2011
           • B.Sc. Computer Science and
               Economics from University of
               Pescara (Italy)
           • Email: enrico@zend.com
Summary
•   Cloud computing in PHP
•   ZendServiceRackspace
•   Examples
•   Simple Cloud API
•   ZendCloudInfrastructure for ZF2 and ZF1
•   Adapters: Amazon Ec2, Rackspace
•   Examples
Cloud computing

“Cloud computing is the delivery of computing as a
   service rather than a product, whereby shared
 resources, software, and information are provided
 to computers and other devices as a utility over a
             network (tipically internet)”
                      Wikipedia
Cloud computing


   What does it means?
  Actually, nothing useful.
Cloud computing


    Do not try to define it,
         just use it!
How to use it?
• API (Application Programming Interface), to
  interact with cloud services
• Typically use REST-based APIs
• Each vendors uses a property API:
   – Different API for each vendor
   – Use of specific PHP libraries (coming from
     community or vendors)
Some PHP libraries for Cloud
• Amazon Web Services
  – AWS SDK for PHP, http://aws.amazon.com/sdkforphp/
• Windows Azure
  – PHPAzure, http://phpazure.codeplex.com/
• Rackspace
  – php-cloudfiles, http://bit.ly/ptJa1Y
• GoGrid
  – GoGridClient, http://bit.ly/o7MeLA
ZF service classes for Cloud
•   ZendServiceAmazon
•   ZendServiceGoGrid (under development)
•   ZendServiceNirvanix
•   ZendServiceRackspace
•   ZendServiceWindowsAzure
ZendService
 Rackspace
ZendServiceRackspace

• Manage the following cloud services of
  Rackspace:
  – Servers
  – Files
• Provide a full OO interface for the API of
  Rackspace (ver 1.0)
• Release: ZF1 1.12+, ZF2 dev3+
Example: authentication
$user = 'username';
$key = 'secret key';

$rackspace = new ZendServiceRackspaceFiles($user,$key);

if ($rackspace->authenticate()) {
   echo "Authentication successfully";
} else {
   printf("ERROR: %s",$rackspace->getErrorMsg());
}
Example: store an image in a container
…
$container = $rackspace->createContainer('test');
if (!$rackspace->isSuccessful()) {
    die('ERROR: '.$rackspace->getErrorMsg());
}
$name = 'example.jpg';
$file = file_get_contents($name);
$metadata = array (
    'foo' => 'bar'
);
$rackspace->storeObject('test',$name,$file,$metadata);
if ($rackspace->isSuccessful()) {
    echo 'Object stored successfully';
} else {
    printf("ERROR: %s",$rackspace->getErrorMsg());
}
Example: create a new instance (server)
$user = 'username';
$key = 'secret key';

$rackspace = new ZendServiceRackspaceServers($user,$key);

$data = array (
    'name'     => 'test',
    'imageId' => '49',
    'flavorId' => '1',
);
$server = $rackspace->createServer($data);

if (!$rackspace->isSuccessful()) {
    die('ERROR: '.$rackspace->getErrorMsg());
}

printf("Server name    : %sn",$server->getName());
printf("Server Id      : %sn",$server->getId());
printf("Admin password : %sn",$server->getAdminPass());
Simple Cloud API
Simple Cloud API
• The Simple Cloud API is a common API for
  accessing cloud application services offered by
  multiple vendors
• Starting from November 2010 the Simple Cloud
  API is part of Zend Framework under the
  classname:
   – Zend_Cloud (ZF1)
   – ZendCloud (ZF2)
Why we need it?
• Vendor lock-in
  – In economics, vendor lock-in makes a
    customer dependent on a vendor for products
    and services, unable to use another vendor
    without substantial switching costs
• Portability
  – reuse the existing code instead of creating
    new code when moving software from an
    environment to another
The architecture




             ZendCloud


             ZendService
The architecture (2)



                ZendCloud
 Document   Queue       Storage   Infrastructure



               ZendService
ZendCloud as abstraction
• ZendCloud is an abstraction of the main
  features of some cloud vendors
• Vendor specific functions may not be included in
  ZendCloud (for portability reason)
  – For instance, Amazon S3 has a cleanBucket
    operation that is not implemented in ZendCloud
• You can access the concrete adapters to use
  specific functions (getAdapter)
ZendCloudDocumentService
• Abstracts the interfaces to all major document
  databases - both in the cloud and locally
  deployed
• Adapters:
   – Amazon SimpleDB
   – Windows Azure
ZendCloudQueueService
• The QueueService implements access to
  message queues available as local or remote
  services.
• Adapters:
   – Amazon Sqs
   – Windows Azure
   – ZendQueue
ZendCloudStorageService
• The storage service in the Simple Cloud API
  implements a basic interface for file storage on
  the cloud
• Adapters:
   – Amazon S3
   – Windows Azure
   – Nirvanix
   – Filesystem
   – Rackspace (under development)
ZendCloud
Infrastructure
ZendCloudInfrastructure
• Manage instances (servers) of a cloud
  computing infrastructure
• Release ZF1: 1.12+, ZF2: dev3+
• Adapters:
   – Amazon Ec2
   – Rackspace Cloud Servers
   – GoGrid (under development)
   – Windows Azure (under development)
Basic operations
•   Create a new instance
•   Delete an instance
•   Start/stop/reboot an instance
•   List available instances
•   Get the status of an instance (running, stop, etc)
•   Monitor an instance (CPU, RAM, Network, etc)
•   Deploy an instance
     – Execute remote shell command (using SSH2)
Image of an instance
• An image of an instance is the collection of the
  following information:
   – Operating system (OS)
   – Memory available (RAM)
   – CPU type
Example: Ec2 Adapter
use ZendCloudInfrastructureAdapterEc2 as Ec2Adapter,
    ZendCloudInfrastructureFactory;

$key    = 'key';
$secret = 'secret';
$region = 'region';

$infrastructure = Factory::getAdapter(array(
    Factory::INFRASTRUCTURE_ADAPTER_KEY =>
'ZendCloudInfrastructureAdapterEc2',
    Ec2Adapter::AWS_ACCESS_KEY => $key,
    Ec2Adapter::AWS_SECRET_KEY => $secret,
    Ec2Adapter::AWS_REGION     => $region,
));
Example: create an instance
$param= array (
    'imageId'      => 'your-image-id',
    'instanceType' => 'your-instance-type',
);

$instance= $infrastructure->createInstance('name', $param);

if ($instance===false) {
   die ('Error');
}

printf ("Name of the instance: %sn", $instance->getName());
printf ("ID of the instance : %sn", $instance->getId());
Example: reboot and wait for status

if (!$infrastructure->rebootInstance('instance-id')) {
    die ('Error in the execution of the reboot command');
}
echo 'Reboot command executed successfully';

if ($infrastructure->waitStatusInstance('instance-id',
Instance::STATUS_RUNNING)) {
    echo 'The instance is ready';
} else {
    echo 'The instance is not ready yet';
}
Wait for status change
waitStatusInstance (string $id, string $status,integer
$timeout=30)
• Wait the status change of an instance for a
  maximum time of n seconds (30 by default).
• Return true if the status changes as expected,
  false otherwise.
Example: monitor an instance
use ZendCloudInfrastructureInstance;

$cpuUsage= $infrastructure->monitorInstance(
            'instance-id',Instance::MONITOR_CPU);

var_dump($cpuUsage);


array(2) {                                   [2] => array(2) {
 ["series"] => array(3) {                      ["timestamp"] => int(1318348920)
   [0]=> array(2) {                            ["value"] => int(60)
     ["timestamp"] => int(1318348800)        }
     ["value"]=> int(80)                    }
   }                                        ["average"] => string(3) "70%"
   [1]=> array(2) {                     }
     ["timestamp"] => int(1318348860)
     ["value"] => int(70)
   }
Example: deploy an instance

$nodeId= 'id-instance';

$param= array (
    Instance::SSH_USERNAME => 'username',
    Instance::SSH_PASSWORD => 'password'
);

$cmd= 'ls -la /var/www';

$output= $infrastructure->deployInstance($nodeId,$param,$cmd);

echo "The files in the DocumentRoot of the $nodeId instance
are:n";
print_r ($output);


Note: require the SSH2 extension
Thank you!
• Vote this talk:
  – http://joind.in/3880

• Comments and feedbacks:
  – enrico@zend.com
1 of 34

Recommended

Manage cloud infrastructures in PHP using Zend Framework 2 (and 1) by
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)Enrico Zimuel
3.5K views34 slides
Zend Framework 2 quick start by
Zend Framework 2 quick startZend Framework 2 quick start
Zend Framework 2 quick startEnrico Zimuel
9.6K views45 slides
A quick start on Zend Framework 2 by
A quick start on Zend Framework 2A quick start on Zend Framework 2
A quick start on Zend Framework 2Enrico Zimuel
16.5K views52 slides
ZF2 Presentation @PHP Tour 2011 in Lille by
ZF2 Presentation @PHP Tour 2011 in LilleZF2 Presentation @PHP Tour 2011 in Lille
ZF2 Presentation @PHP Tour 2011 in LilleZend by Rogue Wave Software
1.8K views45 slides
Cryptography with Zend Framework by
Cryptography with Zend FrameworkCryptography with Zend Framework
Cryptography with Zend FrameworkEnrico Zimuel
3.3K views20 slides
Zend Framework 2 Patterns by
Zend Framework 2 PatternsZend Framework 2 Patterns
Zend Framework 2 PatternsZend by Rogue Wave Software
1.9K views61 slides

More Related Content

What's hot

9 password security by
9   password security9   password security
9 password securitydrewz lin
5.2K views37 slides
Secure password - CYBER SECURITY by
Secure password - CYBER SECURITYSecure password - CYBER SECURITY
Secure password - CYBER SECURITYSupanShah2
570 views10 slides
Passwords presentation by
Passwords presentationPasswords presentation
Passwords presentationGreg MacPherson
3K views15 slides
Java Symmetric by
Java SymmetricJava Symmetric
Java Symmetricphanleson
1.5K views36 slides
Bring your infrastructure under control with Infrastructor by
Bring your infrastructure under control with InfrastructorBring your infrastructure under control with Infrastructor
Bring your infrastructure under control with InfrastructorStanislav Tiurikov
509 views18 slides
Strong cryptography in PHP by
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHPEnrico Zimuel
5.7K views38 slides

What's hot(20)

9 password security by drewz lin
9   password security9   password security
9 password security
drewz lin5.2K views
Secure password - CYBER SECURITY by SupanShah2
Secure password - CYBER SECURITYSecure password - CYBER SECURITY
Secure password - CYBER SECURITY
SupanShah2570 views
Java Symmetric by phanleson
Java SymmetricJava Symmetric
Java Symmetric
phanleson1.5K views
Bring your infrastructure under control with Infrastructor by Stanislav Tiurikov
Bring your infrastructure under control with InfrastructorBring your infrastructure under control with Infrastructor
Bring your infrastructure under control with Infrastructor
Stanislav Tiurikov509 views
Strong cryptography in PHP by Enrico Zimuel
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHP
Enrico Zimuel5.7K views
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java by Howard Lewis Ship
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Howard Lewis Ship998 views
Ростислав Михайлив "Zend Framework 3 - evolution or revolution" by Fwdays
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Fwdays830 views
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor by Stanislav Tiurikov
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorGr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Stanislav Tiurikov931 views
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ by ConFoo
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
ConFoo2.7K views
One Step Ahead of Cheaters -- Instrumenting Android Emulators by Priyanka Aash
One Step Ahead of Cheaters -- Instrumenting Android EmulatorsOne Step Ahead of Cheaters -- Instrumenting Android Emulators
One Step Ahead of Cheaters -- Instrumenting Android Emulators
Priyanka Aash2.1K views
Building DSLs with Xtext - Eclipse Modeling Day 2009 by Heiko Behrens
Building DSLs with Xtext - Eclipse Modeling Day 2009Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009
Heiko Behrens2.2K views
Effective Doctrine2: Performance Tips for Symfony2 Developers by Marcin Chwedziak
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 Developers
Marcin Chwedziak36.6K views
Security 202 - Are you sure your site is secure? by ConFoo
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?
ConFoo2.5K views
Advanced Eclipse Workshop (held at IPC2010 -spring edition-) by Bastian Feder
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder1.5K views
Getting started with developing Nodejs by Phil Hawksworth
Getting started with developing NodejsGetting started with developing Nodejs
Getting started with developing Nodejs
Phil Hawksworth2.6K views
Groovy Domain Specific Languages - SpringOne2GX 2012 by Guillaume Laforge
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge5.1K views

Viewers also liked

Cryptography in PHP: use cases by
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use casesEnrico Zimuel
14.5K views36 slides
Foundation vs Bootstrap - CC FE & UX by
Foundation vs Bootstrap - CC FE & UXFoundation vs Bootstrap - CC FE & UX
Foundation vs Bootstrap - CC FE & UXJWORKS powered by Ordina
1.1K views32 slides
Follow the White Rabbit - Message Queues with PHP by
Follow the White Rabbit - Message Queues with PHPFollow the White Rabbit - Message Queues with PHP
Follow the White Rabbit - Message Queues with PHPEric Rodriguez (Hiring in Lex)
13.7K views43 slides
Open a window, see the clouds - php|tek 2011 by
Open a window, see the clouds - php|tek 2011Open a window, see the clouds - php|tek 2011
Open a window, see the clouds - php|tek 2011Rafael Dohms
4.1K views98 slides
Responsive Web Design by
Responsive Web DesignResponsive Web Design
Responsive Web DesignDhruva Krishnan
446 views31 slides
Realtime Communication Techniques with PHP by
Realtime Communication Techniques with PHPRealtime Communication Techniques with PHP
Realtime Communication Techniques with PHPWaterSpout
74.3K views62 slides

Viewers also liked(15)

Cryptography in PHP: use cases by Enrico Zimuel
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use cases
Enrico Zimuel14.5K views
Open a window, see the clouds - php|tek 2011 by Rafael Dohms
Open a window, see the clouds - php|tek 2011Open a window, see the clouds - php|tek 2011
Open a window, see the clouds - php|tek 2011
Rafael Dohms4.1K views
Realtime Communication Techniques with PHP by WaterSpout
Realtime Communication Techniques with PHPRealtime Communication Techniques with PHP
Realtime Communication Techniques with PHP
WaterSpout74.3K views
Getting started with CSS frameworks using Zurb foundation by Melanie Archer
Getting started with CSS frameworks using Zurb foundationGetting started with CSS frameworks using Zurb foundation
Getting started with CSS frameworks using Zurb foundation
Melanie Archer34.2K views
Socket programming with php by Elizabeth Smith
Socket programming with phpSocket programming with php
Socket programming with php
Elizabeth Smith26.6K views
Phone calls and sms from php by David Stockton
Phone calls and sms from phpPhone calls and sms from php
Phone calls and sms from php
David Stockton667 views
Mobile Push Notifications by Mike Willbanks
Mobile Push NotificationsMobile Push Notifications
Mobile Push Notifications
Mike Willbanks24.9K views
Twitter Bootstrap vs ZURB Foundation Version 3 by Jen Kramer
Twitter Bootstrap vs ZURB Foundation Version 3Twitter Bootstrap vs ZURB Foundation Version 3
Twitter Bootstrap vs ZURB Foundation Version 3
Jen Kramer11.5K views
MOM - Message Oriented Middleware by Peter R. Egli
MOM - Message Oriented MiddlewareMOM - Message Oriented Middleware
MOM - Message Oriented Middleware
Peter R. Egli29.4K views
Basic concepts of object oriented programming by Sachin Sharma
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma50.7K views

Similar to Manage cloud infrastructures using Zend Framework 2 (and ZF1)

How to Manage Cloud Infrastructures using Zend Framework by
How to Manage Cloud Infrastructures using Zend FrameworkHow to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkZend by Rogue Wave Software
1K views37 slides
대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016 by
대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016
대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016Amazon Web Services Korea
3.5K views40 slides
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon... by
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...MUG-Lyon Microsoft User Group
643 views55 slides
Playing with php_on_azure by
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azureCEDRIC DERUE
2.1K views56 slides
ILM - Pipeline in the cloud by
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloudAaron Carey
10.6K views41 slides
Reusable, composable, battle-tested Terraform modules by
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesYevgeniy Brikman
28.4K views150 slides

Similar to Manage cloud infrastructures using Zend Framework 2 (and ZF1)(20)

대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016 by Amazon Web Services Korea
대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016
대용량 데이타 쉽고 빠르게 분석하기 :: 김일호 솔루션즈 아키텍트 :: Gaming on AWS 2016
Playing with php_on_azure by CEDRIC DERUE
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azure
CEDRIC DERUE2.1K views
ILM - Pipeline in the cloud by Aaron Carey
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloud
Aaron Carey10.6K views
Reusable, composable, battle-tested Terraform modules by Yevgeniy Brikman
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
Yevgeniy Brikman28.4K views
Puppetpreso by ke4qqq
PuppetpresoPuppetpreso
Puppetpreso
ke4qqq439 views
Managing Infrastructure as Code by Allan Shone
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
Allan Shone691 views
Amazon Web Services for PHP Developers by Jeremy Lindblom
Amazon Web Services for PHP DevelopersAmazon Web Services for PHP Developers
Amazon Web Services for PHP Developers
Jeremy Lindblom3K views
Puppet and CloudStack by ke4qqq
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
ke4qqq545 views
Building a serverless company on AWS lambda and Serverless framework by Luciano Mammino
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless framework
Luciano Mammino1.5K views
Puppet and Apache CloudStack by Puppet
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
Puppet4.2K views
Infrastructure as code with Puppet and Apache CloudStack by ke4qqq
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
ke4qqq667 views
How to build a Citrix infrastructure on AWS by Denis Gundarev
How to build a Citrix infrastructure on AWSHow to build a Citrix infrastructure on AWS
How to build a Citrix infrastructure on AWS
Denis Gundarev11.1K views
AWS CloudFormation Intrinsic Functions and Mappings by Adam Book
AWS CloudFormation Intrinsic Functions and Mappings AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings
Adam Book4.3K views
Cloud Computing in PHP With the Amazon Web Services by Amazon Web Services
Cloud Computing in PHP With the Amazon Web ServicesCloud Computing in PHP With the Amazon Web Services
Cloud Computing in PHP With the Amazon Web Services
Amazon Web Services6.4K views
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv by Amazon Web Services
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Amazon Web Services1.2K views
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming by Amazon Web Services Korea
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming

More from Enrico Zimuel

Password (in)security by
Password (in)securityPassword (in)security
Password (in)securityEnrico Zimuel
10.5K views38 slides
Integrare Zend Framework in Wordpress by
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressEnrico Zimuel
6.6K views38 slides
Quick start on Zend Framework 2 by
Quick start on Zend Framework 2Quick start on Zend Framework 2
Quick start on Zend Framework 2Enrico Zimuel
12.5K views42 slides
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche by
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheEnrico Zimuel
1.9K views15 slides
PHP goes mobile by
PHP goes mobilePHP goes mobile
PHP goes mobileEnrico Zimuel
3.3K views24 slides
Zend Framework 2 by
Zend Framework 2Zend Framework 2
Zend Framework 2Enrico Zimuel
3.5K views61 slides

More from Enrico Zimuel(20)

Password (in)security by Enrico Zimuel
Password (in)securityPassword (in)security
Password (in)security
Enrico Zimuel10.5K views
Integrare Zend Framework in Wordpress by Enrico Zimuel
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in Wordpress
Enrico Zimuel6.6K views
Quick start on Zend Framework 2 by Enrico Zimuel
Quick start on Zend Framework 2Quick start on Zend Framework 2
Quick start on Zend Framework 2
Enrico Zimuel12.5K views
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche by Enrico Zimuel
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Enrico Zimuel1.9K views
Framework software e Zend Framework by Enrico Zimuel
Framework software e Zend FrameworkFramework software e Zend Framework
Framework software e Zend Framework
Enrico Zimuel1.1K views
How to scale PHP applications by Enrico Zimuel
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
Enrico Zimuel29.5K views
Velocizzare Joomla! con Zend Server Community Edition by Enrico Zimuel
Velocizzare Joomla! con Zend Server Community EditionVelocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community Edition
Enrico Zimuel2K views
Zend_Cache: how to improve the performance of PHP applications by Enrico Zimuel
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
Enrico Zimuel6.4K views
XCheck a benchmark checker for XML query processors by Enrico Zimuel
XCheck a benchmark checker for XML query processorsXCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processors
Enrico Zimuel819 views
Introduzione alle tabelle hash by Enrico Zimuel
Introduzione alle tabelle hashIntroduzione alle tabelle hash
Introduzione alle tabelle hash
Enrico Zimuel662 views
Crittografia quantistica: fantascienza o realtà? by Enrico Zimuel
Crittografia quantistica: fantascienza o realtà?Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?
Enrico Zimuel763 views
Introduzione alla crittografia by Enrico Zimuel
Introduzione alla crittografiaIntroduzione alla crittografia
Introduzione alla crittografia
Enrico Zimuel733 views
Crittografia è sinonimo di sicurezza? by Enrico Zimuel
Crittografia è sinonimo di sicurezza?Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?
Enrico Zimuel648 views
Sviluppo di applicazioni sicure by Enrico Zimuel
Sviluppo di applicazioni sicureSviluppo di applicazioni sicure
Sviluppo di applicazioni sicure
Enrico Zimuel390 views
Misure minime di sicurezza informatica by Enrico Zimuel
Misure minime di sicurezza informaticaMisure minime di sicurezza informatica
Misure minime di sicurezza informatica
Enrico Zimuel690 views
La sicurezza delle applicazioni in PHP by Enrico Zimuel
La sicurezza delle applicazioni in PHPLa sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHP
Enrico Zimuel431 views

Recently uploaded

Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...NUS-ISS
23 views70 slides
.conf Go 2023 - Data analysis as a routine by
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routineSplunk
90 views12 slides
"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy by
"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy
"Role of a CTO in software outsourcing company", Yuriy NakonechnyyFwdays
40 views21 slides
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... by
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...Vadym Kazulkin
70 views64 slides
TE Connectivity: Card Edge Interconnects by
TE Connectivity: Card Edge InterconnectsTE Connectivity: Card Edge Interconnects
TE Connectivity: Card Edge InterconnectsCXL Forum
96 views12 slides

Recently uploaded(20)

Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS23 views
.conf Go 2023 - Data analysis as a routine by Splunk
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routine
Splunk90 views
"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy by Fwdays
"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy
"Role of a CTO in software outsourcing company", Yuriy Nakonechnyy
Fwdays40 views
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... by Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin70 views
TE Connectivity: Card Edge Interconnects by CXL Forum
TE Connectivity: Card Edge InterconnectsTE Connectivity: Card Edge Interconnects
TE Connectivity: Card Edge Interconnects
CXL Forum96 views
Understanding GenAI/LLM and What is Google Offering - Felix Goh by NUS-ISS
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix Goh
NUS-ISS39 views
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada119 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk86 views
AMD: 4th Generation EPYC CXL Demo by CXL Forum
AMD: 4th Generation EPYC CXL DemoAMD: 4th Generation EPYC CXL Demo
AMD: 4th Generation EPYC CXL Demo
CXL Forum126 views
The Importance of Cybersecurity for Digital Transformation by NUS-ISS
The Importance of Cybersecurity for Digital TransformationThe Importance of Cybersecurity for Digital Transformation
The Importance of Cybersecurity for Digital Transformation
NUS-ISS25 views
Photowave Presentation Slides - 11.8.23.pptx by CXL Forum
Photowave Presentation Slides - 11.8.23.pptxPhotowave Presentation Slides - 11.8.23.pptx
Photowave Presentation Slides - 11.8.23.pptx
CXL Forum126 views
MemVerge: Gismo (Global IO-free Shared Memory Objects) by CXL Forum
MemVerge: Gismo (Global IO-free Shared Memory Objects)MemVerge: Gismo (Global IO-free Shared Memory Objects)
MemVerge: Gismo (Global IO-free Shared Memory Objects)
CXL Forum112 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi113 views
CXL at OCP by CXL Forum
CXL at OCPCXL at OCP
CXL at OCP
CXL Forum208 views
GigaIO: The March of Composability Onward to Memory with CXL by CXL Forum
GigaIO: The March of Composability Onward to Memory with CXLGigaIO: The March of Composability Onward to Memory with CXL
GigaIO: The March of Composability Onward to Memory with CXL
CXL Forum126 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10165 views
Liqid: Composable CXL Preview by CXL Forum
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum121 views
AI: mind, matter, meaning, metaphors, being, becoming, life values by Twain Liu 刘秋艳
AI: mind, matter, meaning, metaphors, being, becoming, life valuesAI: mind, matter, meaning, metaphors, being, becoming, life values
AI: mind, matter, meaning, metaphors, being, becoming, life values

Manage cloud infrastructures using Zend Framework 2 (and ZF1)

  • 1. Enrico Zimuel Zend Technologies Manage Cloud Infrastructures in PHP using Zend Framework 2 (and ZF1)
  • 2. About me • Software Engineer since 1996 – Assembly x86, C/C++, Java, Perl, PHP • Enjoying PHP since 1999 • PHP Engineer at Zend since 2008 • ZF Core Team from April 2011 • B.Sc. Computer Science and Economics from University of Pescara (Italy) • Email: enrico@zend.com
  • 3. Summary • Cloud computing in PHP • ZendServiceRackspace • Examples • Simple Cloud API • ZendCloudInfrastructure for ZF2 and ZF1 • Adapters: Amazon Ec2, Rackspace • Examples
  • 4. Cloud computing “Cloud computing is the delivery of computing as a service rather than a product, whereby shared resources, software, and information are provided to computers and other devices as a utility over a network (tipically internet)” Wikipedia
  • 5. Cloud computing What does it means? Actually, nothing useful.
  • 6. Cloud computing Do not try to define it, just use it!
  • 7. How to use it? • API (Application Programming Interface), to interact with cloud services • Typically use REST-based APIs • Each vendors uses a property API: – Different API for each vendor – Use of specific PHP libraries (coming from community or vendors)
  • 8. Some PHP libraries for Cloud • Amazon Web Services – AWS SDK for PHP, http://aws.amazon.com/sdkforphp/ • Windows Azure – PHPAzure, http://phpazure.codeplex.com/ • Rackspace – php-cloudfiles, http://bit.ly/ptJa1Y • GoGrid – GoGridClient, http://bit.ly/o7MeLA
  • 9. ZF service classes for Cloud • ZendServiceAmazon • ZendServiceGoGrid (under development) • ZendServiceNirvanix • ZendServiceRackspace • ZendServiceWindowsAzure
  • 11. ZendServiceRackspace • Manage the following cloud services of Rackspace: – Servers – Files • Provide a full OO interface for the API of Rackspace (ver 1.0) • Release: ZF1 1.12+, ZF2 dev3+
  • 12. Example: authentication $user = 'username'; $key = 'secret key'; $rackspace = new ZendServiceRackspaceFiles($user,$key); if ($rackspace->authenticate()) { echo "Authentication successfully"; } else { printf("ERROR: %s",$rackspace->getErrorMsg()); }
  • 13. Example: store an image in a container … $container = $rackspace->createContainer('test'); if (!$rackspace->isSuccessful()) { die('ERROR: '.$rackspace->getErrorMsg()); } $name = 'example.jpg'; $file = file_get_contents($name); $metadata = array ( 'foo' => 'bar' ); $rackspace->storeObject('test',$name,$file,$metadata); if ($rackspace->isSuccessful()) { echo 'Object stored successfully'; } else { printf("ERROR: %s",$rackspace->getErrorMsg()); }
  • 14. Example: create a new instance (server) $user = 'username'; $key = 'secret key'; $rackspace = new ZendServiceRackspaceServers($user,$key); $data = array ( 'name' => 'test', 'imageId' => '49', 'flavorId' => '1', ); $server = $rackspace->createServer($data); if (!$rackspace->isSuccessful()) { die('ERROR: '.$rackspace->getErrorMsg()); } printf("Server name : %sn",$server->getName()); printf("Server Id : %sn",$server->getId()); printf("Admin password : %sn",$server->getAdminPass());
  • 16. Simple Cloud API • The Simple Cloud API is a common API for accessing cloud application services offered by multiple vendors • Starting from November 2010 the Simple Cloud API is part of Zend Framework under the classname: – Zend_Cloud (ZF1) – ZendCloud (ZF2)
  • 17. Why we need it? • Vendor lock-in – In economics, vendor lock-in makes a customer dependent on a vendor for products and services, unable to use another vendor without substantial switching costs • Portability – reuse the existing code instead of creating new code when moving software from an environment to another
  • 18. The architecture ZendCloud ZendService
  • 19. The architecture (2) ZendCloud Document Queue Storage Infrastructure ZendService
  • 20. ZendCloud as abstraction • ZendCloud is an abstraction of the main features of some cloud vendors • Vendor specific functions may not be included in ZendCloud (for portability reason) – For instance, Amazon S3 has a cleanBucket operation that is not implemented in ZendCloud • You can access the concrete adapters to use specific functions (getAdapter)
  • 21. ZendCloudDocumentService • Abstracts the interfaces to all major document databases - both in the cloud and locally deployed • Adapters: – Amazon SimpleDB – Windows Azure
  • 22. ZendCloudQueueService • The QueueService implements access to message queues available as local or remote services. • Adapters: – Amazon Sqs – Windows Azure – ZendQueue
  • 23. ZendCloudStorageService • The storage service in the Simple Cloud API implements a basic interface for file storage on the cloud • Adapters: – Amazon S3 – Windows Azure – Nirvanix – Filesystem – Rackspace (under development)
  • 25. ZendCloudInfrastructure • Manage instances (servers) of a cloud computing infrastructure • Release ZF1: 1.12+, ZF2: dev3+ • Adapters: – Amazon Ec2 – Rackspace Cloud Servers – GoGrid (under development) – Windows Azure (under development)
  • 26. Basic operations • Create a new instance • Delete an instance • Start/stop/reboot an instance • List available instances • Get the status of an instance (running, stop, etc) • Monitor an instance (CPU, RAM, Network, etc) • Deploy an instance – Execute remote shell command (using SSH2)
  • 27. Image of an instance • An image of an instance is the collection of the following information: – Operating system (OS) – Memory available (RAM) – CPU type
  • 28. Example: Ec2 Adapter use ZendCloudInfrastructureAdapterEc2 as Ec2Adapter, ZendCloudInfrastructureFactory; $key = 'key'; $secret = 'secret'; $region = 'region'; $infrastructure = Factory::getAdapter(array( Factory::INFRASTRUCTURE_ADAPTER_KEY => 'ZendCloudInfrastructureAdapterEc2', Ec2Adapter::AWS_ACCESS_KEY => $key, Ec2Adapter::AWS_SECRET_KEY => $secret, Ec2Adapter::AWS_REGION => $region, ));
  • 29. Example: create an instance $param= array ( 'imageId' => 'your-image-id', 'instanceType' => 'your-instance-type', ); $instance= $infrastructure->createInstance('name', $param); if ($instance===false) { die ('Error'); } printf ("Name of the instance: %sn", $instance->getName()); printf ("ID of the instance : %sn", $instance->getId());
  • 30. Example: reboot and wait for status if (!$infrastructure->rebootInstance('instance-id')) { die ('Error in the execution of the reboot command'); } echo 'Reboot command executed successfully'; if ($infrastructure->waitStatusInstance('instance-id', Instance::STATUS_RUNNING)) { echo 'The instance is ready'; } else { echo 'The instance is not ready yet'; }
  • 31. Wait for status change waitStatusInstance (string $id, string $status,integer $timeout=30) • Wait the status change of an instance for a maximum time of n seconds (30 by default). • Return true if the status changes as expected, false otherwise.
  • 32. Example: monitor an instance use ZendCloudInfrastructureInstance; $cpuUsage= $infrastructure->monitorInstance( 'instance-id',Instance::MONITOR_CPU); var_dump($cpuUsage); array(2) { [2] => array(2) { ["series"] => array(3) { ["timestamp"] => int(1318348920) [0]=> array(2) { ["value"] => int(60) ["timestamp"] => int(1318348800) } ["value"]=> int(80) } } ["average"] => string(3) "70%" [1]=> array(2) { } ["timestamp"] => int(1318348860) ["value"] => int(70) }
  • 33. Example: deploy an instance $nodeId= 'id-instance'; $param= array ( Instance::SSH_USERNAME => 'username', Instance::SSH_PASSWORD => 'password' ); $cmd= 'ls -la /var/www'; $output= $infrastructure->deployInstance($nodeId,$param,$cmd); echo "The files in the DocumentRoot of the $nodeId instance are:n"; print_r ($output); Note: require the SSH2 extension
  • 34. Thank you! • Vote this talk: – http://joind.in/3880 • Comments and feedbacks: – enrico@zend.com