Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::OpsWorks::Layer

Creates an AWS OpsWorks layer. A layer defines, for example, which packages and applications are installed and how they are configured.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

Copy
{ "Type": "AWS::OpsWorks::Layer", "Properties": { "Attributes" : { String:String }, "AutoAssignElasticIps" : Boolean, "AutoAssignPublicIps" : Boolean, "CustomInstanceProfileArn" : String, "CustomJson" : JSON object, "CustomRecipes" : Recipes, "CustomSecurityGroupIds" : [ String, ... ], "EnableAutoHealing" : Boolean, "InstallUpdatesOnBoot" : Boolean, "LifecycleEventConfiguration" : LifeCycleEventConfiguration, "LoadBasedAutoScaling" : LoadBasedAutoScaling, "Name" : String, "Packages" : [ String, ... ], "Shortname" : String, "StackId" : String, "Type" : String, "VolumeConfigurations" : [ VolumeConfiguration, ... ] } }

YAML

Copy
Type: "AWS::OpsWorks::Layer" Properties: Attributes: String:String AutoAssignElasticIps: Boolean AutoAssignPublicIps: Boolean CustomInstanceProfileArn: String CustomRecipes: Recipes CustomJson: JSON object CustomSecurityGroupIds: - String EnableAutoHealing: Boolean InstallUpdatesOnBoot: Boolean LifecycleEventConfiguration: LifeCycleEventConfiguration LoadBasedAutoScaling: LoadBasedAutoScaling Name: String Packages: - String Shortname: String StackId: String Type: String VolumeConfigurations: - VolumeConfiguration

Properties

Attributes

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

Required: No

Type: A list of key-value pairs

Update requires: No interruption

AutoAssignElasticIps

Whether to automatically assign an Elastic IP address to Amazon EC2 instances in this layer.

Required: Yes

Type: Boolean

Update requires: No interruption

AutoAssignPublicIps

For AWS OpsWorks stacks that are running in a VPC, whether to automatically assign a public IP address to Amazon EC2 instances in this layer.

Required: Yes

Type: Boolean

Update requires: No interruption

CustomInstanceProfileArn

The Amazon Resource Name (ARN) of an IAM instance profile that is to be used for the Amazon EC2 instances in this layer.

Required: No

Type: String

Update requires: No interruption

CustomJson

A custom stack configuration and deployment attributes that AWS OpsWorks installs on the layer's instances. For more information, see the CustomJson parameter for the CreateLayer action in the AWS OpsWorks Stacks API Reference.

Required: No

Type: JSON object

CustomRecipes

Custom event recipes for this layer.

Required: No

Type: AWS OpsWorks Recipes Type

Update requires: No interruption

CustomSecurityGroupIds

Custom security group IDs for this layer.

Required: No

Type: List of strings

Update requires: No interruption

EnableAutoHealing

Whether to automatically heal Amazon EC2 instances that have become disconnected or timed out.

Required: Yes

Type: Boolean

Update requires: No interruption

InstallUpdatesOnBoot

Whether to install operating system and package updates when the instance boots.

Required: No

Type: Boolean

Update requires: No interruption

LifecycleEventConfiguration

The lifecycle events for the AWS OpsWorks layer.

Required: No

Type: AWS OpsWorks Layer LifeCycleConfiguration

Update requires: No interruption

LoadBasedAutoScaling

The load-based scaling configuration for the AWS OpsWorks layer.

Required: No

Type: AWS OpsWorks LoadBasedAutoScaling Type

Update requires: No interruption

Name

The AWS OpsWorks layer name.

Required: Yes

Type: String

Update requires: No interruption

Packages

The packages for this layer.

Required: No

Type: List of strings

Update requires: No interruption

Shortname

The layer short name, which is used internally by AWS OpsWorks and by Chef recipes. The short name is also used as the name for the directory where your app files are installed.

The name can have a maximum of 200 characters, which are limited to the alphanumeric characters, '-', '_', and '.'.

Important

If you update a property that requires the layer to be replaced, you must specify a new short name. You cannot have multiple layers with the same short name.

Required: Yes

Type: String

Update requires: No interruption

StackId

The ID of the AWS OpsWorks stack that this layer will be associated with.

Required: Yes

Type: String

Update requires: Replacement

Type

The layer type. A stack cannot have more than one layer of the same type, except for the custom type. You can have any number of custom types. For more information, see CreateLayer in the AWS OpsWorks Stacks API Reference.

Important

If you update a property that requires the layer to be replaced, you must specify a new type unless you have a custom type. You can have any number of custom types.

Required: Yes

Type: String

Update requires: Replacement

VolumeConfigurations

Describes the Amazon EBS volumes for this layer.

Required: No

Type: A list of AWS OpsWorks VolumeConfiguration Type

Update requires: Some interruptions

Return Values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource name. For example:

Copy
{ "Ref": "myLayer" }

For the AWS OpsWorks layer myLayer, Ref returns the AWS OpsWorks layer ID.

For more information about using the Ref function, see Ref.

Template Snippet

AWS OpsWorks PHP Layer

The following snippet creates an AWS OpsWorks PHP layer that is associated with the myStack AWS OpsWorks stack. The layer is dependent on the myApp AWS OpsWorks application.

JSON

Copy
"myLayer": { "Type": "AWS::OpsWorks::Layer", "DependsOn": "myApp", "Properties": { "StackId": {"Ref": "myStack"}, "Type": "php-app", "Shortname" : "php-app", "EnableAutoHealing" : "true", "AutoAssignElasticIps" : "false", "AutoAssignPublicIps" : "true", "Name": "MyPHPApp" } }

YAML

Copy
myLayer: Type: "AWS::OpsWorks::Layer" DependsOn: "myApp" Properties: StackId: Ref: "myStack" Type: "php-app" Shortname: "php-app" EnableAutoHealing: "true" AutoAssignElasticIps: "false" AutoAssignPublicIps: "true" Name: "MyPHPApp"

Load-based Auto Scaling Layer

The following snippet creates a load-based automatic scaling AWS OpsWorks PHP layer that is associated with the myStack AWS OpsWorks stack.

JSON

Copy
"myLayer": { "Type": "AWS::OpsWorks::Layer", "DependsOn": "myApp", "Properties": { "StackId": {"Ref": "myStack"}, "Type": "php-app", "Shortname" : "php-app", "EnableAutoHealing" : "true", "AutoAssignElasticIps" : "false", "AutoAssignPublicIps" : "true", "Name": "MyPHPApp", "LoadBasedAutoScaling" : { "Enable" : "true", "UpScaling" : { "InstanceCount" : 1, "ThresholdsWaitTime" : 1, "IgnoreMetricsTime" : 1, "CpuThreshold" : 70.0, "MemoryThreshold" : 30.0, "LoadThreshold" : 0.7 }, "DownScaling" : { "InstanceCount" : 1, "ThresholdsWaitTime" : 1, "IgnoreMetricsTime" : 1, "CpuThreshold" : 30.0, "MemoryThreshold" : 70.0, "LoadThreshold" : 0.3 } } } }

YAML

Copy
myLayer: Type: "AWS::OpsWorks::Layer" DependsOn: "myApp" Properties: StackId: Ref: "myStack" Type: "php-app" Shortname: "php-app" EnableAutoHealing: "true" AutoAssignElasticIps: "false" AutoAssignPublicIps: "true" Name: "MyPHPApp" LoadBasedAutoScaling: Enable: "true" UpScaling: InstanceCount: 1 ThresholdsWaitTime: 1 IgnoreMetricsTime: 1 CpuThreshold: 70 MemoryThreshold: 30 LoadThreshold: 0.7 DownScaling: InstanceCount: 1 ThresholdsWaitTime: 1 IgnoreMetricsTime: 1 CpuThreshold: 30 MemoryThreshold: 70 LoadThreshold: 0.3

See Also