Best practice sending SMS with EC2 PHP without the AWS PHP SDK

0

Hello!

We would like to use text messages SMS to our clients for certain functions of our website. We are using EC2 with Apache and like to send an SMS with PHP without using the AWS PHP SDK. We cannot find out how to send commands with PHP directly to AWS SNS or to AWS Pinpoint. The telephone numbers come from our database so using 'topics' would seem not usable.

Any help is appreciated!

1 Answer
1
Accepted Answer

Since you are running the PHP app on an EC2 instance, you can attach an instance profile to the instance to make the SNS or Pinpoint API calls with SDK with minimal configurations. If you need an alternative way, an easy workaround is to use a REST API in API Gateway. You can have the API method to make an SNS/Pinpoint API call. So, the end users in this case PHP app on EC2 can hit the API endpoint to indirectly send messages through SNS/Pinpoint. However, it is still recommended that you secure the API.

What is the reason behind not wanting to use AWS SDK?

AWS
Taka_M
answered a year ago
  • Pardon me for the late response. The API workaround seems acceptable for us. We prefer not to use the AWS SDK for PHP because we could not find the way to build the SDK with only the SNS components and its dependencies. Now we would need the entire SDK loaded on the server which creates a lot of code clutter and unnecessary tools we do not need nor want.

    Thank you for your time to answer my question.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions