v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1474216311.3 KB

Creates a layer. For more information, see How to Create a Layer.

You should use CreateLayer for noncustom layer types such as PHP App Server only if the stack does not have an existing layer of that type. A stack can have at most one instance of each noncustom layer; if you attempt to create a second instance, CreateLayer fails. A stack can have an arbitrary number of custom layers, so you can call CreateLayer as many times as you like for that layer type.

Required Permissions: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.

post/#X-Amz-Target=OpsWorks_20130218.CreateLayer

Headers

X-Amz-Target'OpsWorks_20130218.CreateLayer' required

Request body

StackIdstring required

The layer stack ID.

Type'aws-flow-ruby' | 'ecs-cluster' | 'java-app' | 'lb' | 'web' | 'php-app' | 'rails-app' | 'nodejs-app' | 'memcached' | 'db-master' | 'monitoring-master' | 'custom' required

The layer type. A stack cannot have more than one built-in layer of the same type. It can have any number of custom layers. Built-in layers are not available in Chef 12 stacks.

Namestring required

The layer name, which is used by the console.

Shortnamestring required
<p>For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef recipes. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters, which are limited to the alphanumeric characters, '-', '_', and '.'.</p> <p>The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/layers.html">Layer Reference</a>.</p>
Attributesobject
<p>One or more user-defined key-value pairs to be added to the stack attributes.</p> <p>To create a cluster layer, set the <code>EcsClusterArn</code> attribute to the cluster's ARN.</p>
CustomInstanceProfileArnstring

The ARN of an IAM profile to be used for the layer's EC2 instances. For more information about IAM ARNs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">Using Identifiers</a>.

CustomJsonstring

A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json-override.html"> Using Custom JSON</a>. This feature is supported as of version 1.7.42 of the AWS CLI.

CustomSecurityGroupIdsString[]

An array containing the layer custom security group IDs.

PackagesString[]

An array of <code>Package</code> objects that describes the layer packages.

EnableAutoHealingboolean

Whether to disable auto healing for the layer.

AutoAssignElasticIpsboolean

Whether to automatically assign an <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html">Elastic IP address</a> to the layer's instances. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html">How to Edit a Layer</a>.

AutoAssignPublicIpsboolean

For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html">How to Edit a Layer</a>.

InstallUpdatesOnBootboolean
<p>Whether to install operating system and package updates when the instance boots. The default value is <code>true</code>. To control when updates are installed, set this value to <code>false</code>. You must then update your instances manually by using <a>CreateDeployment</a> to run the <code>update_dependencies</code> stack command or by manually running <code>yum</code> (Amazon Linux) or <code>apt-get</code> (Ubuntu) on the instances. </p> <note> <p>To ensure that your instances have the latest security updates, we strongly recommend using the default value of <code>true</code>.</p> </note>
UseEbsOptimizedInstancesboolean

Whether to use Amazon EBS-optimized instances.

Response

Success

LayerIdstring

The layer ID.