我真的想将一个lambda订阅者发布到一个SNS主题。它适用于亚马逊控制台,但使用php-sdk却没有。当我执行php代码并查看CloudWatch时,没有任何内容(没有响应)。为什么我的SNS不起作用?
这是我的代码,但它不起作用:
....
$credentials = new Credentials($access, $secret);
$this->aws_client = new SnsClient(
array(
'region' => 'us-east-1',
'version' => 'latest',//'version' => '2010-03-31',
'credentials' => $credentials
)
);
...
$message = "Hello H.";
$message_atr = array('String' => array('DataType' => 'String', 'StringValue' => $message));
$payload = array(
'TargetArn' => 'arn:aws:sns:us-east-1:****:mysns',
'Message' => $message,
'MessageAttributes' => $message_atr,
);
$this->aws_client->publish($payload);