$result = $s3->putObject(['ACL' => 'public-read', 'Bucket' => $bucket, 'Key' => "Hello" . $uploadfile, 'ContentType' => $_FILES['userfile']['tmp_name'], 'Body' => fopen($uploadfile, 'r+')]);
$url = $result['ObjectURL'];
echo $url;
$result = $s3->getObject(array('Bucket' => $bucket, 'Key' => "Hello" . $uploadfile, 'ContentType' => $_FILES['userfile']['tmp_name'], 'SaveAs' => '/tmp/originalimage.jpg'));
$image = new Imagick(glob('/tmp/originalimage.jpg'));
$image->oilPaintImage(2);
//Oilpaint image
$image->setImageFormat("jpg");
$image->writeImages('/tmp/modifiedimage.jpg', true);
$modifiedbucket = uniqid("modified-image-", false);
$result = $s3->createBucket(['ACL' => 'public-read', 'Bucket' => $modifiedbucket]);
$resultrendered = $s3->putObject(['ACL' => 'public-read', 'Bucket' => $modifiedbucket, 'Key' => "Hello" . $uploadfile, 'SourceFile' => "/tmp/modifiedimage.jpg", 'ContentType' => $_FILES['userfile']['tmp_name'], 'Body' => fopen("/tmp/modifiedimage.jpg", 'r+')]);
unlink('/tmp/modifiedimage.jpg');
$finishedurl = $resultrendered['ObjectURL'];
echo $finishedurl;
$expiration = $s3->putBucketLifecycleConfiguration(['Bucket' => $bucket, 'LifecycleConfiguration' => ['Rules' => [['Expiration' => ['Date' => '2015-12-25'], 'Prefix' => ' ', 'Status' => 'Enabled']]]]);
$expiration = $s3->putBucketLifecycleConfiguration(['Bucket' => $modifiedbucket, 'LifecycleConfiguration' => ['Rules' => [['Expiration' => ['Date' => '2015-12-25'], 'Prefix' => ' ', 'Status' => 'Enabled']]]]);
$rds = new Aws\Rds\RdsClient(['version' => 'latest', 'region' => 'us-east-1']);
$result = $rds->describeDBInstances(['DBInstanceIdentifier' => 'mp1-db']);
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
print "============\n" . $endpoint . "================";
print_r($result);
# Database connection
$link = mysqli_connect($endpoint, "controller", "letmein888", "customerrecords", 3306) or die("Error " . mysqli_error($link));
# Check database connection
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
echo "Connection to database correct ";
# Inserting data int the database