Tuesday, January 14, 2014

I've Been Published

My book, "Pro PowerShell for Amazon Web Services," was published today.  It's been a long road, but a great experience.


I took down anything related to AWS a few months ago to avoid a conflict of interest.  Now I can start blogging about AWS again.


2 comments:

  1. I'm having an issue with code in your book...
    I'm trying to set the expiration of a bucket using Write-S3LifecycleConfiguration as shown in Chapter 10, but I get the following:

    Write-S3LifecycleConfiguration : The XML you provided was not well-formed or did not validate against our published schema
    At line:10 char:1
    + Write-S3LifecycleConfiguration -BucketName 'bde-sqlbackups' -Configuration_Rules ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (Amazon.PowerShe...igurationCmdlet:WriteS3LifecycleConfigurationCmdlet) [Write-S3LifecycleConfiguration], Inva
    lidOperationException
    + FullyQualifiedErrorId : Amazon.S3.AmazonS3Exception,Amazon.PowerShell.Cmdlets.S3.WriteS3LifecycleConfigurationCmdlet

    ReplyDelete
  2. Mike,

    You are correct. I was able to reproduce the issue. It looks like the latest version of the toolkit requires that you set the prefix property on the LifecycleRule to something. It seems that setting it to NULL fixes the issue. The code below works for me (second to last line is the change). I'll reach out to my contacts at AWS for comment and post something to the errata for the book. Thanks for reaching out.

    New-S3Bucket -BucketName 'brianbeach'

    $Transition = New-object Amazon.S3.Model.LifecycleTransition
    $Transition.Days = 7
    $Transition.StorageClass = 'Glacier'

    $Expiration = New-Object Amazon.S3.Model.LifecycleRuleExpiration
    $Expiration.Days = 365

    $Rule = New-Object Amazon.S3.Model.LifecycleRule
    $Rule.Transition = $Transition
    $Rule.Expiration = $Expiration
    $Rule.Prefix = $null
    Write-S3LifecycleConfiguration -BucketName 'brianbeach' -Configuration_Rules $Rule

    ReplyDelete