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

aws_volume (5) Versions 0.1.2

Managing AWS ebs resources

Policyfile
Berkshelf
Knife
cookbook 'aws_volume', '= 0.1.2', :supermarket
cookbook 'aws_volume', '= 0.1.2'
knife supermarket install aws_volume
knife supermarket download aws_volume
README
Dependencies
Changelog
Quality 100%

Description

This cookbook provides libraries, resources and providers to configure
and manage Amazon Web Services components and offerings with the EC2
API. Currently supported resources:

  • EBS Volumes (ebs_volume)

Requirements

Requires Chef 10.X or higher for Lightweight Resource and Provider
support. Chef 11+ is recommended. While this cookbook can be used in
chef-client with a Chef Server.

An Amazon Web Services account is required. The Access Key and Secret
Access Key are used to authenticate with EC2 or an instance with IAM role recommended.

AWS Credentials

In order to manage AWS components, authentication credentials need to
be available to the node. There are 2 way to handle this:
* Load credentials from data bag (only support encrypted databag)
* explicitly pass credentials parameter to the resource
* or let the resource pick up credentials from the IAM role assigned to the instance

Recipes

default.rb

The default recipe installs the aws_sdk RubyGem, which this
cookbook requires in order to work with the aws API. Make sure that
the aws recipe is in the node or role run_list before any resources
from this cookbook are used.

"run_list": [
  "recipe[aws_volume]"
]

The gem_package is created as a Ruby Object and thus installed
during the Compile Phase of the Chef run.

Libraries

The cookbook has a library module, AWS::Ec2, which can be
included where necessary:

include Aws::Ec2

This is needed in any providers in the cookbook. Along with some
helper methods used in the providers, it sets up a class variable,
ec2 that is used along with the access and secret access keys

Resources and Providers

This cookbook provides one resources and corresponding providers.

ebs_volume.rb

Manage Elastic Block Store (EBS) volumes with this resource.

Actions:

  • create - create a new volume.
  • attach - attach the specified volume.

Attribute Parameters For Action Create:

  • aws_secret_key, aws_access_key (optional) - passed to AWS:Ec2 to authenticate required, unless using IAM roles for authentication.
  • size - size of the volume in gigabytes.
  • snapshot_id (optional) - snapshot to build EBS volume from.
  • device (optional) - local block device to attach the volume to, e.g. /dev/sdi but no default value, required. used when both create and attach action called in same recipe.
  • volume_type (optional) - "standard" or "io1" (io1 is the type for IOPS volume). Default was set to standard.
  • iops - number of Provisioned IOPS to provision, must be >= 100. Default was set to 0
  • data_bag (optional) - provide data bag and key details to load AWS credentials. eg: data_bag["NAME", "Key"]

  • Example of Volume create recipe

The below recipe will create a new volume from snapshot_id 'snap-XXXX' and attached to the instance as '/dev/sdb'

aws_volume_ebs_volume "db_ebs_volume" do
    snapshot_id "snap-XXXX"
    device "/dev/sdb"
    action [ :create, :attach ]
end 

The below recipe will create a new volume with size 1G and attached to the instance as '/dev/sda'

aws_volume_ebs_volume "db_ebs_volume" do
    size 1
    device "/dev/sda"
    action [ :create, :attach ]
end

The below recipe will create a new volume with size 1G

aws_volume_ebs_volume "db_ebs_volume" do
    size 1
    action [ :create ]
end

The below recipe will only attach the the given vloume id

aws_volume_ebs_volume "db_ebs_volume" do
    volume_id "vol-d6af1dd3"
    device "/dev/sdb"
    action [ :attach ]
end

The below recipe will take AWS access and secret key from data bag

aws_volume_ebs_volume "db_ebs_volume" do
    size 1
    device "/dev/sda"
    data_bag [ "EC2", "key" ]
    action [ :create, :attach ]
end

Attribute Parameters For Action Attach:

  • aws_secret_key, aws_access_key (optional) - passed to AWS:Ec2 to authenticate required, unless using IAM roles for authentication
  • device - local block device to attach the volume to, e.g. /dev/sdi
  • volume_id - ID of the volume which need to be attached.

To Do:

Integrate below action

  • detach - detach the specified volume.
  • snapshot - create a snapshot of the volume.
  • prune - prune snapshots.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

aws_volume CHANGELOG

0.1.0

  • [pradeep] - Initial release of aws_volume

Check the Markdown Syntax Guide for help with Markdown.

The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.

Foodcritic Metric
            

0.1.2 passed this metric