简体   繁体   English

致命错误:通过php sdk运行deploy命令时,Aws \\ OpsWorks \\ Exception \\ ValidationException未捕获:AWS错误代码:ValidationException

[英]Fatal error: Uncaught Aws\OpsWorks\Exception\ValidationException: AWS Error Code: ValidationException when running deploy command through php sdk

I've been trying to send an OpsWorks deploy command through the SDK but i get this error: 我一直在尝试通过SDK发送OpsWorks部署命令,但出现此错误:

Fatal error: Uncaught Aws\OpsWorks\Exception\ValidationException: AWS Error Code:  ValidationException, Status Code: 400, AWS Request ID: f33c4c59-f48c-11e2-9764-4d0c126d6399, AWS Error Type: client, AWS Error Message: , User-Agent: aws-sdk-php2/2.4.1 Guzzle/3.7.1 curl/7.24.0 PHP/5.3.15
  thrown in /Users/bigtallbill/REPOS/WEB-APPLICATION/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91

And this is my test code: 这是我的测试代码:

<?php

require_once "vendor/autoload.php";
use Aws\S3\S3Client;
use Aws\OpsWorks\OpsWorksClient;

define('AWS_KEY', 'mykey');
define('AWS_SECRET', 'mySecret');
define('AWS_OPSWORKS_STACKID', 'my-stack-id');

$opsWorksClient = OpsWorksClient::factory(array(
    'key'    => AWS_KEY,
    'secret' => AWS_SECRET,
    'region' => 'us-east-1'
));

$result = $opsWorksClient->createDeployment(array(
    'StackId' => AWS_OPSWORKS_STACKID,
    'Command' => array(
        'Name' => 'deploy'
    )
));

var_dump($result);

Been hammering my head against this for the better part of a day now. 在一天中的大部分时间里,我一直在努力应对。 I've tried using the latest master as well as the most recent release version. 我已经尝试使用最新的master版本以及最新的发行版本。

Additionally my application can be deployed normally through the web interface. 另外,可以通过Web界面正常部署我的应用程序。 I am also using my normal AWS keys, not an IAM user. 我也在使用普通的AWS密钥,而不是IAM用户。

Any help is greatly appreciated :) 任何帮助是极大的赞赏 :)

用于createDeploymentAPI文档提到,在部署应用程序时还需要AppId参数。

I'm not as familiar with the PHP syntax, but here's a Ruby code snippet that works. 我对PHP语法不太熟悉,但这是一个有效的Ruby代码段。 Do you need the first array? 您是否需要第一个数组? opsworks.create_deployment(:stack_id => app[:stack_id], :app_id => app_id, :instance_ids => instance_ids, :command => {:name => 'deploy'}) opsworks.create_deployment(:stack_id => app [:stack_id],:app_id => app_id,:instance_ids => instance_ids,:command => {:name =>'deploy'})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM