Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

AWS Developer Blog:
Introducing support for Amazon S3 Select in the AWS SDK for PHP
Sep 17, 2018 @ 14:28:17

On the AWS Developer Blog they've posted an announcement about the release of support for Amazon S3 Select in the AWS SDK for PHP. This "select" functionality allows for more powerful queries on the contents currently in your S3 buckets.

We’re excited to announce support for the Amazon Simple Storage Service (Amazon S3) SelectObjectContent API with event streams in the AWS SDK for PHP in version 3.67.11. Using Amazon S3 Select, you can query for a subset of data from an S3 object by using simple SQL expressions.

Amazon S3 streams the responses as a series of events, instead of returning the full API response all at once. This enables your applications to process the parts of the response as the application receives them. To support this new API behavior, the AWS SDK for PHP supports processing these events from the API response.

The post goes on to give a few examples of the use of the "select" functionality, querying the contents of a CSV file using the familiar SQL format. Example code is also included using the SelectObjectContent and EventParsingIterator to select and retrieve the results.

tagged: amazon aws s3 select support release awssdk tutorial

Link: https://aws.amazon.com/blogs/developer/introducing-support-for-amazon-s3-select-in-the-aws-sdk-for-php/

AWS Developer Blog:
Using Client-Side Encryption for Amazon S3 in the AWS SDK for PHP
Nov 10, 2017 @ 16:11:16

On the AWS Developer blog they've posted a new tutorial showing you how to use client-side encryption in the AWS PHP SDK for interactions with the AWS S3 service.

The AWS SDK for PHP released an S3EncryptionClient in version 3.38.0. With client-side encryption, data is encrypted and decrypted directly in your environment. This means that this data is encrypted before it’s transferred to Amazon S3, and you don’t rely on an external service to handle encryption for you.

The AWS SDK for PHP implements envelope encryption and uses OpenSSL for its encrypting and decrypting. The implementation is interoperable with other SDKs that match its feature support. It’s also compatible with the SDK’s promise-based asynchronous workflow.

The tutorial then walks you through the setup of a new S3EncryptionClient instance and how to use the putObject method to push the file contents up to S3 automagically using the encryption. It also includes a code example of pulling the file contents down and decrypting the contents via a getObject call.

tagged: aws s3 sdk tutorial encrypt decrypt client tutorial

Link: https://aws.amazon.com/blogs/developer/using-client-side-encryption-for-amazon-s3-in-the-aws-sdk-for-php/

Michael Dyrynda:
Uploading files to Amazon S3 from the browser - Part One
Nov 06, 2017 @ 17:58:34

Michael Dyrynda has a tutorial posted to his site starting off a new series showing how to create the functionality in your application to upload files to Amazon S3 from the browser. The tutorial is designed for those that don't already have something in their framework that allows for this upload handling.

I recently took on a freelance project that involved having to upload media files. This is a trivially simple task to accomplish if you're using something like Laravel, using out-of-the-box support for S3 storage.

In this particular case, however, I was dealing with files potentially multiple gigabytes in size. Although a simpler to implement, I didn't want to have to have users of the site upload the file to my application - and thus server - before having my server re-upload the file to S3.

In his case, he needed something that would allow for the upload of very large files without having to pass it through the backend server to get there. He starts by walking you through the setup on the S3 side, creating an IAM policy for the upload and a form that points to the instance. The form includes a "key" value that contains the filename for the end result. He also shows some of the other options that can be included like the policy to use a redirect location and a signature to verify the upload. He then shows the code required to make it work, creating an upload route and a main form page that generates the signature and policy information for the form based on configuration options.

tagged: amazon s3 upload tutorial part1 series direct post

Link: https://dyrynda.com.au/blog/uploading-files-to-amazon-s3-from-the-browser-part-one

Laravel News:
Minio: An Open-Source S3 Compliant Storage Service
Aug 07, 2017 @ 14:33:23

On the Laravel News site they've posted a tutorial showing you how to use Minio for storage and integrate it into a Laravel application as another filesystem location.

Have you ever wanted a local version of Amazon S3 while developing Laravel applications? Well want no more, Minio is an open-source distributed object storage server built in Golang. The best part: Minio is Amazon S3 compatible. Let’s go through setting up Minio locally and then try out the new temporaryUrl method introduced in Laravel v5.4.31.

They walk you through the setup of the Minio server (locally, instructions are for brew on OS X) how to access it directly to ensure it is up and running. The tutorial then shows how to integrate it into the Laravel configuration as another file system location (as it is S3 compliant). It also shows how to create a "test" bucket for the content storage and using the "Storage" handling to push a file to the Minio service.

tagged: minio s3 storage opensource laravel tutorial integration golang

Link: https://laravel-news.com/minio-s3-compliant-storage

Phillip Shipley:
How to automatically deploy static single-page-apps to Amazon S3 and Cloudfront or
Jun 02, 2017 @ 15:39:26

Phillip Shipley has a post to his site for the AWS and Cloudflare users out there (or those that want to use these together) about an easy way to automatically deploy static sites.

Managing web servers can be a lot of work. Especially when it comes to configuring and maintaining SSL certs, server and software updates, etc. Let’s Encrypt has made the SSL part a lot easier, but it is still work and to me feels like overkill for something as simple as a static single-page-application. Especially when there are dead simple solutions like Amazon S3 that can be used to host and scale a static website without any server configuration or maintenance. Adding CloudFront with a free SSL certificate from Amazon’s Certificate Manager service make SSL painless too.

[...] In this article I’ll cover how to use Codeship’s continuous integration and deployment service to build/test your app, deploy it to S3, and then clear cached versions of it from CloudFront and Cloudflare.

He then shows how to use the Codeship service to do the actual deployment, broken down into a few steps:

  • Step 1: Setting up project in Codeship
  • Step 2: Configure Tests
  • Step 3: Configure Environment Variables
  • Step 4: Configure Deployment

Each step includes both screenshots and configuration examples you'll need to get the workflow set up and running for your site.

tagged: deploy tutorial singlepage amazon s3 cloudfront cloudflare codeship process

Link: http://www.phillipshipley.com/2017/05/how-to-automatically-deploy-single-page-apps-to-amazon-s3-and-cloudfront-or-cloudflare-using-codeship/

TutsPlus.com:
Programming With Yii2: Using Amazon S3
Dec 08, 2016 @ 17:27:16

The TutsPlus.com site has continued their series of posts in the "Programming with Yii2" series with this new tutorial covering the use of the Amazon S3 service for sorting files remotely in your application.

In today's tutorial, I'll walk you through the basics of browsing, uploading and downloading files to and from Amazon's cloud-based S3 storage service. Essentially, I've created a simple storage model and controller as examples which you can extend for your needs.

He starts with a brief introduction to the S3 service (including a video from Amazon themselves) and what kinds of things it could be used for. He helps you get started via the AWS web GUI, creating an S3 "bucket" and viewing their contents. He shows how to get the credentials you'll need to connect to the bucket and defining them in the ini configuration file. The tutorial then shows how to use this AWS extension for Yii2 to connect to and work with the S3 bucket you've created. This includes browsing the content, uploading new files and downloading current ones.

tagged: yii2 framework series amazon s3 file storage download upload tutorial

Link: https://code.tutsplus.com/tutorials/programming-with-yii2-using-amazon-s3--cms-26347

Cees-Jan Kiewiet:
Deploying Sculpin to S3 with CircleCI
Jun 16, 2016 @ 16:56:12

Cees-Jan Kiewiet has written up a post showing how he combines S3 and CircleCI to deploy a Sculpin site for his blog. Sculpin is a popular PHP-based static site generator.

Until 10 minutes before the start of this month I had a VPS at Digital Ocean running with Jenkins and Gitolite on it for privately hosted repositories. With Github's recent move to unlimited repositories I really didn't have a need to host them myself anymore, and after playing with CircleCI's free tier it didn't make any sense anymore to keep that VPS up.

Since porting git over to another remote is as more Github's domain we're focusing on deploying Sculpin to S3 using CircleCI in this post.

He starts by outlining some of the prerequisites to get in place before trying to set up the process on your own application. He shows you how to set up an IAM user for the S3 bucket and configure CircleCI though a simple YAML file. He also mentions the set up for tests, loading in other dependencies needed (Composer) and finally the deployment that executes Sculpin's "generate" command to build the site.

tagged: sculpin circleci s3 aws deployment tutorial configuration setup

Link: https://blog.wyrihaximus.net/2016/06/deploying-sculpin-to-s3-with-circleci/

Chris White:
Avoiding the burden of file uploads
Jun 14, 2016 @ 14:18:59

Chris White has a post to his site sharing a method he's come up with to avoid the burden of file uploads in your PHP application with the help of the offerings of Amazon S3 and some creative coding.

Handling file uploads sucks. Code-wise it's a fairly simple task, the files get sent along with a POST request and are available server-side in the $_FILES super global. Your framework of choice may even have a convenient way of dealing with these files, probably based on Symfony's UploadedFile class. Unfortunately it's not that simple.

[...] For most situations using S3 is a no brainer, but the majority of developers transfer their user's uploads to S3 after they have received them on the server side. This doesn't have to be the case, your user's web browser can send the file directly to an S3 bucket. You don't even have to open the bucket up to the public. Signed upload URLs with an expiry will allow temporary access to upload a single object.

He points out two advantages of this method: that you don't have to handle the upload part of file uploads and that it gives the user more control. He shares a video of the end result (a simple file upload frontend) and the code that you'll need to use the AWS PHP SDK to make it all work together. There's some configuration changes that'll need to be made on the S3 bucket side (like for CORS) but the code itself to make the connection is relatively simple. He does a great job of explaining every step of the way and includes the Javascript needed for the frontend as well.

tagged: file upload amazon s3 aws tutorial frontend

Link: https://cwhite.me/avoiding-the-burden-of-file-uploads/

Jack Skinner:
In search of simplicity a - story of blog automation
Apr 03, 2015 @ 14:54:37

Jack Skinner has a new post to his site showing how he rewrote his blog aiming for simplicity with the help of Sculpin and Codeship.

I’ve recently relaunched my blog (hi everyone!), I’ll migrate some old content and scrap others. While I clean up the content however I wanted to share how the new site has come into being.

He starts off talking about why he chose to go with Sculpin but doesn't get too much into it as there are "plenty of posts and content around" on how to get started. He then talks about the Codeship service and share some of the initial setup commands and setting up a deployment pipeline to an AWS instance. He makes use of the S3 website hosting, Route53 and CloudFront services for the serving of the actual site. Codeship makes it simple to deploy a new build whenever he updates or adds a new post too.

tagged: simplicity blog automation sculpin codeship aws s3

Link: https://developerjack.com/blog/2015/03/31/in-search-of-simplicity-automating-my-blog/

Amazon Web Services PHP Blog:
Syncing Data with Amazon S3
Jun 28, 2013 @ 16:57:59

On the Amazon AWS blog there's a recent post showing you how to sync data with S3 and handle multiple files quickly and easily.

Have you ever needed to upload an entire directory of files to Amazon S3 or download an Amazon S3 bucket to a local directory? With a recent release of the AWS SDK for PHP, this is now not only possible, but really simple.

He includes example code for doing it both ways - upload and download syncing - as well as some options you can use to customize the connection. You can define things like ACL settings, the number of concurrent connections and if you want the debug options turned off or on.

tagged: sync amazon s3 tutorial upload download

Link: http://blogs.aws.amazon.com/php/post/Tx2W9JAA7RXVOXA/Syncing-Data-with-Amazon-S3


Trending Topics: