Amazon EC2 addon for Cake
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build/scripts
nuspec
src
test
.gitattributes
.gitignore
LICENSE
README.md
ReleaseNotes.md
appveyor.yml
build-skip-restore.bat
build-skip-test.bat
build.bat
build.cake
build.ps1
cake.config

README.md

Cake.AWS.EC2

Cake Build addin for configuring Amazon Elastic Computing

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Table of contents

  1. Implemented functionality
  2. Referencing
  3. Usage
  4. Example
  5. Plays well with
  6. License
  7. Share the love

Implemented functionality

  • Start Instances
  • Stop Instances
  • Terminate Instances
  • Uses AWS fallback credentials (app.config / web.config file, SDK store or credentials file, environment variables, instance profile)

Referencing

NuGet Version

Cake.AWS.EC2 is available as a nuget package from the package manager console:

Install-Package Cake.AWS.EC2

or directly in your build script via a cake addin directive:

#addin "Cake.AWS.EC2"

Usage

#addin "Cake.AWS.EC2"

EC2Settings settings = new UploadSettings()
    {
        AccessKey = "blah",
        SecretKey = "blah",
        Region = RegionEndpoint.EUWest1
    };



Task("Start-Instances")
    .Description("Starts an EC2 instances.")
    .Does(async () =>
{
    await StartEC2Instances("instance1,instance2,instance3", settings);
});

Task("Stop-Instances")
    .Description("Stops an EC2 instances.")
    .Does(async () =>
{
    await StopEC2Instances("instance1,instance2,instance3", settings);
});

Task("Terminate-Instances")
    .Description("Terminates an EC2 instances.")
    .Does(async () =>
{
    await TerminateEC2Instances("instance1,instance2,instance3", settings);
});



Task("Instance-Running")
    .Description("Checks an instance is running.")
    .Does(async () =>
{
    await IsInstanceRunning("instance1", settings);
});

Task("Instance-Stopped-Fallback")
    .Description("Checks an instance is stopped, using AWS Fallback credential")
    .Does(async () =>
{
    await IsInstanceStopped("instance1", Context.CreateEC2Settings());
});

RunTarget("Start-Instances");

Example

A complete Cake example can be found here.

TroubleShooting

  • Please be aware of the breaking changes that occurred with the release of Cake v0.22.0, you will need to upgrade Cake in order to use Cake.AWS.EC2 v0.2.0 or above.

Plays well with

If your EC2 instances are behind ELB load balancers its worth checking out Cake.AWS.ElasticLoadBalancing or if your using Route53 as your DNS server check out Cake.AWS.Route53.

If your looking for a way to trigger cake tasks based on windows events or at scheduled intervals then check out CakeBoss.

License

Copyright (c) 2015 - 2016 Phillip Sharpe

Cake.AWS.EC2 is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please ⭐️ the repository.