cookbook 'marketplace_ami', '~> 0.1.0'
marketplace_ami (1) Versions 0.1.0 Follow0
Provides a marketplace_ami resource
cookbook 'marketplace_ami', '~> 0.1.0', :supermarket
knife supermarket install marketplace_ami
knife supermarket download marketplace_ami
marketplace_ami Cookbook
The marketplace_ami cookbook provides a chef resource for publishing AMI's into the AWS Marketplace. The resource will provision a new EC2 instance, converge your application cookbook, create an AMI and share it with AWS Marketplace. Optionally you can enable a security recipe that will remove sensitive data and a chef-client audit mode recipe that will audit the image for known AWS security policies.
Requirements
Chef 12.3.0 or higher.
Chef Provisioning 1.2.0 or higher.
Chef Provisioning AWS 1.2.1 or higher.
The latest versions are always recommended.
Cookbooks
build-essentialxml
Only to be used if chef-provisioning-aws has not been installed
Attributes
The attributes in this cookbook are used only by the the security recipe and audit controls.
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['marketplace_ami']['controls']['cloud_init_enabled']</tt></td>
<td>Boolean</td>
<td>Whether or not the security audit should expect cloud-init to installed</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['marketplace_ami']['controls']['default_user']</tt></td>
<td>String</td>
<td>The default user for SSH access</td>
<td><tt>ec2-user</tt></td>
</tr>
<tr>
<td><tt>['marketplace_ami']['controls']['login_shell']</tt></td>
<td>String</td>
<td>The default users login_shell</td>
<td><tt>/bin/bash</tt></td>
</tr>
</table>
Resources
marketplace_ami
Creates an AWS Marketplace AMI
Actions
-
create- (default) Create an AWS Marketplace AMI
Properties
-
nameThe name of the AMI. -
product_codeThe product code you wish to associate with the AMI -
source_image_idThe base image to launch (Ubuntu 14.04) -
instance_typeThe size of the instance to launch (m4.xlarge) -
ssh_keynameThe name of the SSH keypair (creates a default if not given) -
ssh_keypathThe path to the private SSH key -
ssh_usernameThe username (ubuntu) -
chef_server_urlThe URL to the Chef Server (local default) -
machine_optionsA Hash of additional chef-provisioning machine_options -
securityEnable to disable the security recipe (false) -
security_recipeThe security recipe (marketplace_ami::_security) -
auditEnable to disable the audit recipe (true) -
audit_recipeThe audit recipe (marketplace_ami::_security_controls) -
attributeSet an attribute for the chef-client run -
recipeAdd a recipe to the runlist -
roleAdd a role to the runlist
Usage
Before you being you'll need to properly set up valid EC2 credentials on the node that will be converging the recipe.
Update the metadata.rb of your application's cookbook to depend on 'marketplace_ami'
```ruby
your_application/metadata.rb
name 'your_application'
...
depends 'marketplace_ami'
```
Create a publishing recipe that utilizes the marketplace_ami resource to build your Marketplace AMI
```ruby
your_application/recipes/ami_publisher.rb
marketplace_ami "your_application-#{node['your_application']['version']}" do
instance_type 't2.medium'
source_image_id 'ami-123456'
ssh_keyname 'publisher'
ssh_keypath '~/.aws/publisher.pem'
ssh_username 'ec2-user'
product_code '123799879'
security true
audit true
role 'company_wide_role'
recipe 'your_application::setup'
recipe 'your_application::install'
attribute %w(your_application tofu), 'yes'
attribute %w(your_application brocolli), 'more_please'
action :create
end
```
Run the chef-client!
License and Authors
Author:: Chef Partner Engineering (partnereng@chef.io)
Dependent cookbooks
| build-essential >= 0.0.0 |
| xml >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
0.1.0
Initial release of marketplace_ami
Collaborator Number Metric
0.1.0 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.0 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.0 failed this metric
FC064: Ensure issues_url is set in metadata: marketplace_ami/metadata.rb:1
FC065: Ensure source_url is set in metadata: marketplace_ami/metadata.rb:1
FC066: Ensure chef_version is set in metadata: marketplace_ami/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: marketplace_ami/metadata.rb:1
FC069: Ensure standardized license defined in metadata: marketplace_ami/metadata.rb:1
FC121: Cookbook depends on cookbook made obsolete by Chef 14: marketplace_ami/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: marketplace_ami/libraries/marketplace_ami_provider.rb:102
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.1.0 passed this metric
Testing File Metric
0.1.0 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.0 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
0.1.0 failed this metric
0.1.0 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.0 failed this metric
FC064: Ensure issues_url is set in metadata: marketplace_ami/metadata.rb:1
FC065: Ensure source_url is set in metadata: marketplace_ami/metadata.rb:1
FC066: Ensure chef_version is set in metadata: marketplace_ami/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: marketplace_ami/metadata.rb:1
FC069: Ensure standardized license defined in metadata: marketplace_ami/metadata.rb:1
FC121: Cookbook depends on cookbook made obsolete by Chef 14: marketplace_ami/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: marketplace_ami/libraries/marketplace_ami_provider.rb:102
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.1.0 passed this metric
Testing File Metric
0.1.0 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.0 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
0.1.0 failed this metric
FC065: Ensure source_url is set in metadata: marketplace_ami/metadata.rb:1
FC066: Ensure chef_version is set in metadata: marketplace_ami/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: marketplace_ami/metadata.rb:1
FC069: Ensure standardized license defined in metadata: marketplace_ami/metadata.rb:1
FC121: Cookbook depends on cookbook made obsolete by Chef 14: marketplace_ami/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: marketplace_ami/libraries/marketplace_ami_provider.rb:102
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.1.0 passed this metric
Testing File Metric
0.1.0 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.0 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
0.1.0 failed this metric
0.1.0 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