To perform these operation you will need to follow step below:
Create an IAM role with S3 write access or admin access
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html
Map the IAM role to an EC2 instance
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
Install AWS CLI in EC2 instance
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
Upload to S3:
aws s3 cp ./test.txt s3://mybucket
Download from S3:
aws s3 cp s3://mybucket/test.txt ./
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html
PHP SDK Amazon S3 Transfer Manager:
https://docs.amazonaws.cn/zh_cn/aws-sdk-php/guide/latest/service/s3-transfer.html