diff --git a/GitHub/Watch-Stacks.gif b/GitHub/Watch-Stacks.gif new file mode 100644 index 000000000..73663c5cb Binary files /dev/null and b/GitHub/Watch-Stacks.gif differ diff --git a/Install-VaporShell.ps1 b/Install-VaporShell.ps1 index ef187d9c9..ee05c2a02 100644 --- a/Install-VaporShell.ps1 +++ b/Install-VaporShell.ps1 @@ -17,7 +17,10 @@ Write-Host "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cya $destination = $shell_app.namespace($targetondisk) $destination.Copyhere($zip_file.items(), 0x10) # Rename and import -Write-Host "Renaming folder" -ForegroundColor Cyan -Rename-Item -Path ($targetondisk+"\VaporShell-master") -NewName "VaporShell" -Force +Write-Host "Moving module folder to direct module path" -ForegroundColor Cyan +Move-Item -Path "$targetondisk\VaporShell-master\VaporShell" -Destination $targetondisk -Force +Write-Host -ForegroundColor Cyan "Cleaning up extra files" +Remove-Item -Path "$targetondisk\VaporShell-master" -Force -Recurse -Confirm:$false +Remove-Item -Path $file -Force -Confirm:$false Write-Host "Module has been installed" -ForegroundColor Green Import-Module -Name VaporShell \ No newline at end of file diff --git a/README.md b/README.md index f2f8fea17..9121a63ed 100644 --- a/README.md +++ b/README.md @@ -78,34 +78,44 @@ - [Features](#features) - [Example](#example) - [In Action](#in-action) +- [Prerequisites](#prerequisites) - [Installation](#installation) - [License](#license) ## Features -- __100% coverage:__ if CloudFormation can, VaporShell can too +- __built from AWS's CFN spec sheet:__ 100% coverage of all available CloudFormation resource and property types - __runs on any OS:__ developed and tested in Windows, Ubuntu, and macOS on PowerShell v3-6 -- __validates everything:__ built to make resultant templates reliable -- __goes turbo:__ package and deploy your templates **fast** with one command, `vsl vaporize` +- __validates everything:__ built to make resulting templates reliable by leveraging parameter validation built into PowerShell +- __goes turbo:__ package and deploy your templates **fast** with one command; `vsl vaporize` ## Example -This example... -1. Initializes a VaporShell object -2. Adds a Serverless function with local code as the CodeUri and a schedule of 5 minutes -3. Saves the template as YAML -4. Resolves dependancies and uploads them to an S3 bucket named the same as the stack name "sched-func" -5. Creates a change set with the resolved template -6. Executes the change set -7. Follows with `Watch-Stack` to show colorized Stack Events as they happen ```powershell -$vsl = Initialize-VaporShell -Description "An even more updated function triggered on a timer." -$vsl.AddResource( - ( New-SAMFunction -LogicalId "ScheduledFunction" -Handler "index.handler" -Runtime "nodejs6.10" -CodeUri ".\code" -Events (Add-SAMScheduleEventSource -LogicalId Timer -Schedule "rate(5 minutes)")) -) +#1 Initialize a VaporShell object +$vsl = Initialize-VaporShell -Description "A function triggered on a timer." + +#2 Add a Serverless function with local code as the CodeUri and a schedule of 5 minutes +$samFunction = New-SAMFunction ` + -LogicalId "ScheduledFunction" ` + -Handler "index.handler" ` + -Runtime "nodejs6.10" ` + -CodeUri ".\code" ` + -Events (Add-SAMScheduleEventSource -LogicalId Timer -Schedule "rate(5 minutes)") +$vsl.AddResource($samFunction) $TemplateFile = ".\sched-func.yaml" + +#3 Save the template as YAML using the VaporShell object's ToYAML() method (uses cfn-flip to convert to/from YAML) $vsl.ToYAML($TemplateFile) -vsl vaporize --tf $TemplateFile --sn sched-func --capabilities iam --v --f --w +<#4 Package and deploy the template file (--tf $TemplateFile) as a change set with parameters: + - stack name (--sn) 'sched-func' + - S3 bucket also named 'sched-func' (defaults to the stack name if --s3 is not passed) + - capabilities: CAPABILITY_IAM (--caps iam) + - Verbose (--v) enabled + - Force (--f) enabled (make sure that the bucket is created and objects are uploaded) + - Watch (--w) the stack events in colorized output after executing the change +#> +vsl vaporize --tf $TemplateFile --sn sched-func --caps iam --v --f --w ``` Want to see more examples? Check out the [Examples page](http://vaporshell.io/docs/examples). @@ -116,6 +126,18 @@ Want to see more examples? Check out the [Examples page](http://vaporshell.io/do ![Watch-Stack in action](http://vaporshell.io/images/Watch-Stacks.gif) +## Prerequisites + +- PowerShell v3+ +- .NET 4.5.0+ OR .netstandard 1.3+ + - if you have PowerShell 4+, you're covered! + + +### Recommended + +If you are working with YAML templates, you will need to install AWS Labs' [`cfn-flip`](https://github.com/awslabs/aws-cfn-template-flip). VaporShell uses `cfn-flip` under the hood to work with YAML templates, as PowerShell does not natively support YAML at this time. If you are fine working in JSON, then `cfn-flip` is not needed. + + ## Installation On PowerShell 5+ or [have PowerShellGet installed](https://www.microsoft.com/en-us/download/details.aspx?id=51451)? Install directly from the PowerShell Gallery: @@ -124,7 +146,7 @@ On PowerShell 5+ or [have PowerShellGet installed](https://www.microsoft.com/en- Install-Module VaporShell -Scope CurrentUser ``` -Not on PowerShell 5+? Got you covered too. +Not on PowerShell 5+ and can't install PowerShellGet? Got you covered too. ```powershell Invoke-Expression (New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/scrthq/VaporShell/master/Install-VaporShell.ps1") @@ -132,4 +154,4 @@ Invoke-Expression (New-Object Net.WebClient).DownloadString("https://raw.githubu **Please inspect code before you run it. Here's a handy link to that raw content for you to review: [Install-VaporShell.ps1](https://raw.githubusercontent.com/scrthq/VaporShell/master/Install-VaporShell.ps1)** ## License -[Apache 2.0](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)) +[Apache 2.0](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)) \ No newline at end of file