The `aws s3 sync` command…

From the manual: ‘Syncs directories and S3 prefixes. Recursively copies new and updated files from the source directory to the destination. Only creates folders in the destination if they contain one or more files.’

OMFG, static copy from a directory to an S3 bucket. No middle man / process required. #winning

http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

 

Process:

  • Create an AWS API User, create access key
  • aws configure –profile {your-profile-name}
  • aws s3 sync ./ s3://{existing bucket name}/{prefix} –profile {your-profile-name}
  • Watch your local contents sync up to the bucket.

 

 

The down side of micro-service architecture…

…so at my employ we are attempting to deploy a micro-service style application and thus enjoy all the new hotness that comes with it. The technical issues we are now running into is the deployment for each facet of the application is requiring a different deployment strategy. A quick breakdown is as follows:

  • Middleware: Post test pass push artifact to S3. Trigger CodeDeploy and deploy to EC2 instances as part of an auto-scaling group.
  • Frontend: Static content (HTML/JS/CSS) wherein API calls are requested against the middleware layer, push artifact to S3, trigger Lambda to pull package, unpack to S3, invalidate CloudFront cache
  • Backend: See frontend + handle authentication of user accounts
  • Media Processing: When media is PUT onto S3 trigger Lambda to process media and update database once complete.
  • Application Monitoring: Via in house manage installation of Sentry (they are awesome by the way, you should check it out).

All of this, and this is not even getting into the roles and actions that have to be performed for each environment. The cherry on top: is for the v1.x release of the project. While it enable our clients and in turn there clients to access the application data layer via the middleware and skin the user experience (UX) to desire; the implementation of has a learning curve.

Lesson: If your going micro-service, plan your deployment process VERY carefully ahead of time.

Of environmental parity and testing (pt1).

So funny thing. As a general rule of thumb each environment is suppose to reflect production as much as possible. At work we use Codeception to run acceptance, function and unit based test. In said Codeception we have the BuiltInServer that will serve up the response to the testing request (say fro functional testing). Well `php -S` and nginx return very different things when the post body is over the set limit…

…guess who spent way to long trying to figure out why actual requests where responding correctly but the functional tests where failing :S.

How I got linux SSH to work on windows 10…

So one of the biggest issues I personally have had with windows is the in-ability to emulate a decent Linux terminal. Sure I could dual boot, run a VM or any Os virtualization. But for me, it all seemed very…detached. Well, herein is a solution I have found to be very congruent to my goal:

Step 1 Follow the directions

Provided by http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 to get bash on Windows 10 (they have images as well).

However if you like me and just want the TL;DR:

  • Settings -> Update & Security -> Enable Developer Mode, Click Yes
  • Control Panel -> Program Features -> Turn Windows Feature ON -> Enable ‘Windows Subsystem for Linux’
  • Restart

After restart completes:

  • open a CMD prompt
  • run the command bash
  • provide a username for the linux system -> press enter
  • You should now be back on the CMD promtp -> close window
  • Open a new cmd -> type bash

Gaze in amazement as you now have linux terminal running on windows without the use of a VM.

Now that we are 1/2 way to our goal of SSHing into a remote linux machine, lets move onto the magic part!

Step 2: The fancy footwork

These instruction will not cover how to make a SSH keypair (that is covered at length elsewhere). For this example I had to log into an AWS EC2 instance.  Ensure an instance is running, we have access to the public IP, and a copy of the *.pem key saves on the windows machine somewhere.

 

  • Copy the AWS *.pem file from windows into ~/.ssh:  cp /mnt/c/me/Documents/pem/example.pem ~/.ssh/example.pem
  • chmod 0600 ~/.ssh/example.pem
  • ls -la`-r-x------ 1 root root 1692 Feb  8 21:09 example.pem to ensure the permission did infact change
  • ec2-user@12.34.56.78 -i ~/.ssh/example.pem

If all went well you should be greeted with a welcome message from the remote machine.

Conclusion

Overall not that complicated once the steps are sorted out, but ugg, sorting out all the step on two different platforms. Remindes me of the time we go *AMP running on WindowsXP alongside IIS/.NET/SQL back in my college days. #donotwant

On productive days and how to have one.

Try working at an airport terminal …

Over the course of the better part of the last decade I have worked in start ups, corporate office parks, small but good profit businesses, even a non-profit helping the needy. With each environment come different obstacles

to getting ‘in the zone’. Be it the noise level, the constant interruption the crapped work area, the rhythmic but distract noise of commercial airliners taking off and landing.

Of all the reasons to have for not ‘getting in the zone’ I have found the best thing you can do get a quite area, no distracts, and envelope yourself in the task at hand. If that means wearing ear plugs, so be it. If that means leaving the office floor and working in the quite lobby, by all means. And if so lucky, working from home on the couch (no TV!).

Do what needs to be done to have an environment conducive to being effective.