CreateLayer - OpsWorks

CreateLayer

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

Note

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.

Request Syntax

{ "Attributes": { "string" : "string" }, "AutoAssignElasticIps": boolean, "AutoAssignPublicIps": boolean, "CloudWatchLogsConfiguration": { "Enabled": boolean, "LogStreams": [ { "BatchCount": number, "BatchSize": number, "BufferDuration": number, "DatetimeFormat": "string", "Encoding": "string", "File": "string", "FileFingerprintLines": "string", "InitialPosition": "string", "LogGroupName": "string", "MultiLineStartPattern": "string", "TimeZone": "string" } ] }, "CustomInstanceProfileArn": "string", "CustomJson": "string", "CustomRecipes": { "Configure": [ "string" ], "Deploy": [ "string" ], "Setup": [ "string" ], "Shutdown": [ "string" ], "Undeploy": [ "string" ] }, "CustomSecurityGroupIds": [ "string" ], "EnableAutoHealing": boolean, "InstallUpdatesOnBoot": boolean, "LifecycleEventConfiguration": { "Shutdown": { "DelayUntilElbConnectionsDrained": boolean, "ExecutionTimeout": number } }, "Name": "string", "Packages": [ "string" ], "Shortname": "string", "StackId": "string", "Type": "string", "UseEbsOptimizedInstances": boolean, "VolumeConfigurations": [ { "Encrypted": boolean, "Iops": number, "MountPoint": "string", "NumberOfDisks": number, "RaidLevel": number, "Size": number, "VolumeType": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Attributes

One or more user-defined key-value pairs to be added to the stack attributes.

To create a cluster layer, set the EcsClusterArn attribute to the cluster's ARN.

Type: String to string map

Valid Keys: EcsClusterArn | EnableHaproxyStats | HaproxyStatsUrl | HaproxyStatsUser | HaproxyStatsPassword | HaproxyHealthCheckUrl | HaproxyHealthCheckMethod | MysqlRootPassword | MysqlRootPasswordUbiquitous | GangliaUrl | GangliaUser | GangliaPassword | MemcachedMemory | NodejsVersion | RubyVersion | RubygemsVersion | ManageBundler | BundlerVersion | RailsStack | PassengerVersion | Jvm | JvmVersion | JvmOptions | JavaAppServer | JavaAppServerVersion

Required: No

AutoAssignElasticIps

Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer.

Type: Boolean

Required: No

AutoAssignPublicIps

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 How to Edit a Layer.

Type: Boolean

Required: No

CloudWatchLogsConfiguration

Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream.

Type: CloudWatchLogsConfiguration object

Required: No

CustomInstanceProfileArn

The ARN of an IAM profile to be used for the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers.

Type: String

Required: No

CustomJson

A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON. This feature is supported as of version 1.7.42 of the AWS CLI.

Type: String

Required: No

CustomRecipes

A LayerCustomRecipes object that specifies the layer custom recipes.

Type: Recipes object

Required: No

CustomSecurityGroupIds

An array containing the layer custom security group IDs.

Type: Array of strings

Required: No

EnableAutoHealing

Whether to disable auto healing for the layer.

Type: Boolean

Required: No

InstallUpdatesOnBoot

Whether to install operating system and package updates when the instance boots. The default value is true. To control when updates are installed, set this value to false. You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.

Note

To ensure that your instances have the latest security updates, we strongly recommend using the default value of true.

Type: Boolean

Required: No

LifecycleEventConfiguration

A LifeCycleEventConfiguration object that you can use to configure the Shutdown event to specify an execution timeout and enable or disable Elastic Load Balancer connection draining.

Type: LifecycleEventConfiguration object

Required: No

Name

The layer name, which is used by the console. Layer names can be a maximum of 32 characters.

Type: String

Required: Yes

Packages

An array of Package objects that describes the layer packages.

Type: Array of strings

Required: No

Shortname

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 32 characters, which are limited to the alphanumeric characters, '-', '_', and '.'.

Built-in layer short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference.

Type: String

Required: Yes

StackId

The layer stack ID.

Type: String

Required: Yes

Type

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.

Type: String

Valid Values: aws-flow-ruby | ecs-cluster | java-app | lb | web | php-app | rails-app | nodejs-app | memcached | db-master | monitoring-master | custom

Required: Yes

UseEbsOptimizedInstances

Whether to use Amazon EBS-optimized instances.

Type: Boolean

Required: No

VolumeConfigurations

A VolumeConfigurations object that describes the layer's Amazon EBS volumes.

Type: Array of VolumeConfiguration objects

Required: No

Response Syntax

{ "LayerId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

LayerId

The layer ID.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

ResourceNotFoundException

Indicates that a resource was not found.

HTTP Status Code: 400

ValidationException

Indicates that a request was not valid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: