I am implementing an SMS sending server, for that I am using AWS. I have already used their documentation to carry out all the configuration and installation. I have also placed the files and SDK on the AWS server to run the application. But when running the application, I have no error return, but the SMS does not arrive either.
My code is:
public function SendAwsSms(){
// Passing Aws\Credentials\AssumeRoleCredentialProvider options directly
$profile = new InstanceProfileProvider();
$ARN = "arnkeyprovidedfromaws";
$sessionName = "nameaccessrandom";
$assumeRoleCredentials = new AssumeRoleCredentialProvider([
'client' => new StsClient([
'region' => 'sa-east-1',
'version' => 'latest',
'credentials' => $profile
]),
'assume_role_params' => [
'RoleArn' => $ARN,
'RoleSessionName' => $sessionName,
],
]);
$provider = CredentialProvider::memoize($assumeRoleCredentials);
$SnSclient = new SnsClient([
'region' => 'sa-east-1',
'version'=> 'latest',
]);
try {
$result = $SnSclient->publish([
"SenderID"=>"Idsender",
"SMSType"=>"Promocional",
"Message"=>"Message test",
"PhoneNumber"=>"+1111111111111",
]);
var_dump($result);
} catch (AwsException $e) {
// output error message if fails
error_log($e->getMessage());
}
}
When I run the code, no error is displayed, but the SMS does not arrive at the destination. Can someone show me what's wrong in there? I using PHP, with the CodeIgniter framework, and my system is located in AWS servers.