Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

ec2cron (1) Versions 0.1.1

Installs/Configures ec2cron

Policyfile
Berkshelf
Knife
cookbook 'ec2cron', '~> 0.1.1', :supermarket
cookbook 'ec2cron', '~> 0.1.1'
knife supermarket install ec2cron
knife supermarket download ec2cron
README
Dependencies
Quality 17%

ec2cron Cookbook

Build Status

Provides resources for scheduling ec2 instances to start and stop at pre-defined intervals. Installs AWS cli and manages user profiles as per different security credentials.

Requirements

Platforms

  • Debian / Ubuntu derivatives

Chef

  • Chef 12.1+

Cookbooks

  • poise-python

Usage

This cookbook makes it really easy to manage the scheduling of aws ec2 instances. It provides custom resources to install and manage the aws command line interface and profiles associated with the same. Built upon the cron chef resource, the actions(start/stop) can be defined to run at specific times using the custom resources of this cookbook. The best way to understand the usage is to look at the test cookbook at test/cookbooks/test/recipes.

Recipes

default

The default recipe installs the aws cli with python 2 runtime using the ec2cron_install custom resource. Include this recipe to start with creating the user profiles using ec2cron_profile custom resource.

include_recipe 'ec2cron::default'

Resources (providers)

ec2cron_profile

ec2cron_profile manages user profiles used to perform various aws cli actions.

properties

  • profile_name: Name of the profile
  • aws_access_key: AWS access key
  • aws_secret_access_key: AWS secret access key
  • region: AWS region

actions

  • create
  • delete

example

include_recipe 'ec2cron::default'

ec2cron_profile 'test' do
    aws_access_key 'yourawsaccesskey'
    as_secret_access_key 'yourawssecretaccesskey'
    region 'eu-west-1'
end

ec2cron_profile 'test' do
    action :delete
end

ec2cron_schedule

ec2cron_schedule manages the scheduling of aws ec2 instances in a cron-style declaration.

properties

  • type: The type of ec2 resource with the default being - instance
  • id: The c2 resource id. eg: instance-id
  • state: The desired state of the resource. eg: start
  • profile: The user profile to be used as created by ec2cron_profile
  • minute: Minute at which the action needs to be performed, default being *(every minute)
  • hour: Hour at which the needs to be performed, default being *(every hour)
  • day: Day of action, default being *(everyday)
  • month: Month of action, default being *(every month)
  • weekday: Day of the week starting from 0-sunday to 6-saturday, default being *(every day of the week)

actions

  • create
  • delete

example

ec2cron_schedule 'start test instance' do
    id 'i-testid'
    type 'instance'
    state 'start'
    profile 'test'
    minute '30'
    hour '07'
    weekday '1-5'
    action :create
end

ec2cron_schedule 'stop test instance' do
    id 'i-testid'
    type 'instance'
    state 'stop'
    profile 'test'
    minute '30'
    hour '20'
    weekday '1-5'
    action :create
end

Testing

Unit testing

Custom matchers have been exposed for the resources described above. You can use the apis in your unit tests. Find an implementation of ec2cron Chefspec unit tests in test/cookbooks/test/spec/unit/recipes/.

Integration testing

An implementation of Serverspec integration testing of resources managed by ec2cron cookbook can be found at test/integration/default/serverspec/default_spec.rb

License & Authors

The MIT License

Copyright (C) 2016 by Harish K Bujanga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Dependent cookbooks

poise-python = 1.3.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.1.1 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.1.1 failed this metric

FC008: Generated cookbook metadata needs updating: ec2cron/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ec2cron/metadata.rb:3
FC064: Ensure issues_url is set in metadata: ec2cron/metadata.rb:1
FC066: Ensure chef_version is set in metadata: ec2cron/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ec2cron/metadata.rb:1
FC069: Ensure standardized license defined in metadata: ec2cron/metadata.rb:1
FC115: Custom resource contains a name_property that is required: ec2cron/resources/profile.rb:3
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.1.1 passed this metric

Testing File Metric
            

0.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number