A Chef cookbook for installing and configuring boto. boto is a Python interface to Amazon Web Services (https://github.com/boto/boto#readme).
- python
- build-essential
These attributes are set by the cookbook by default:
node['boto']['fsfreeze']- Whether to use fsfreeze when creating EBS snapshots; default is 'true'node['boto']['ebs']['volume']['size']- The EBS volume size to use for operations such as backup and restore; default is '1'node['boto']['ebs']['volume']['force_detach']- Whether to force detachment when detaching an EBS volume from an instance; default is 'False'node['boto']['ebs']['volume']['mount_point']- The mount point used when attaching or detaching an EBS volume; default is '/mnt/ebs'node['boto']['ebs']['volume']['block_device']- The EBS volume block device to use for operations such as backup and restore; default is '/dev/sdh'node['boto']['ebs']['snapshot']['complete_wait']- The interval time in seconds to wait for an EBS snapshot to complete; default is '5'node['boto']['ec2']['region']['endpoint']- The EC2 region endpoint used for operations; default is 'us-east-1.ec2.amazonaws.com'node['boto']['ec2']['region']['name']- The EC2 region used for operations; default is 'us-east-1'node['boto']['ec2']['availability_zone']- The EC2 availability zone used for operations; default is 'us-east-1a'node['boto']['install_method']- The method used to install the boto library; default is 'package'node['boto']['num_retries']- The number of times boto retries an action; default is '10'node['boto']['attribute']- The debug level for boto; default is '0'
Example node.json to install & configure boto, plus fetch a file from S3:
{
"boto": {
"install_method":"pip",
"aws_access_key_id":"foo",
"aws_secret_access_key":"bar",
"s3_fetch_bucket":"foo_bucket",
"s3_fetch_file":"foo_file.txt",
"s3_fetch_file_destination":"/tmp/foo_file.txt",
},
"run_list": [ "recipe[boto::default]", "recipe[boto::s3_fetch_file]" ]
}
Same, but fetch and extract a zip file from S3 instead:
{
"boto": {
"install_method":"pip",
"aws_access_key_id":"foo",
"aws_secret_access_key":"bar",
"s3_fetch_bucket":"foo_bucket",
"s3_fetch_file":"foo_file.zip",
"s3_fetch_file_destination":"/tmp/foo_file.zip",
"s3_file_extract_destination":"/root"
},
"run_list": [ "recipe[boto::default]", "recipe[boto::s3_fetch_and_extract_file]" ]
}
-
boto::defaultIncludes the boto::install and boto::configure recipes to setup boto on a node. -
boto::installInstalls boto via the method specified by node['boto']['install_method'] (including install of Python by package). -
boto::configureConfigures the boto configuration file locally on the node (/etc/boto.cfg). -
boto::install_from_packageInstalls boto by package only. -
boto::install_from_pipInstalls boto via Python PIP. -
boto::install_from_sourceInstalls boto from source.
These can be used in your run_lists and roles for more 'once-off' type operations, or used in Chef runs of their own on an ad-hoc basis. In the future, LWRPs will be created to effectively deprecate these and will become a matter of convenience only.
boto::ebs_attach_volumeAttaches an EBS volume.boto::ebs_create_snapshotCreates an EBS snapshot from an EBS volume.boto::ebs_detach_volumeDetaches an EBS volume from an EC2 instance.boto::ebs_mount_volumeMounts an EBS volume locally on the system.boto::ebs_print_attached_volumesPrints the attached volumes to an instance.boto::ebs_restore_snapshotRestores an EBS snapshot to a new EBS volume.boto::ebs_unmount_volumeUnmounts an EBS volume from an EC2 instance.
boto::s3_fetch_and_extract_fileFetches an archive from an S3 bucket and extracts its contents locally on the system.boto::s3_fetch_fileFetches a file from an S3 bucket.boto::s3_list_all_bucketsPrints all S3 buckets.boto::s3_store_fileUploads and stores a file in an S3 bucket.
boto::ec2_print_instance_idPrints the EC2 instance ID of the parent system.boto::ec2_print_instance_metadataPrints the instance EC2 metadata of the parent system.
Author:: Chris Fordham (chris.fordham@rightscale.com)
Copyright 2012, RightScale, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.