{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Parameters": {
        "ServiceRole": {
            "Default": "aws-opsworks-service-role",
            "Description": "The OpsWorks service role",
            "Type": "String",
            "MinLength": "1",
            "MaxLength": "64",
            "AllowedPattern": "[a-zA-Z][a-zA-Z0-9-]*",
            "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
        },
        "InstanceRole": {
            "Default": "aws-opsworks-ec2-role",
            "Description": "The OpsWorks instance role",
            "Type": "String",
            "MinLength": "1",
            "MaxLength": "64",
            "AllowedPattern": "[a-zA-Z][a-zA-Z0-9-]*",
            "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
        }
    },
    "Resources": {
        "myStack": {
            "Type": "AWS::OpsWorks::Stack",
            "Properties": {
                "Name": {
                    "Ref": "AWS::StackName"
                },
                "ServiceRoleArn": {
                    "Fn::Join": [
                        "",
                        [
                            "arn:aws:iam::",
                            {
                                "Ref": "AWS::AccountId"
                            },
                            ":role/",
                            {
                                "Ref": "ServiceRole"
                            }
                        ]
                    ]
                },
                "DefaultInstanceProfileArn": {
                    "Fn::Join": [
                        "",
                        [
                            "arn:aws:iam::",
                            {
                                "Ref": "AWS::AccountId"
                            },
                            ":instance-profile/",
                            {
                                "Ref": "InstanceRole"
                            }
                        ]
                    ]
                },
                "UseCustomCookbooks": "true",
                "CustomCookbooksSource": {
                    "Type": "git",
                    "Url": "https://github.com/amazonwebservices/opsworks-cloudwatch-logs-cookbooks"
                }
            }
        },
        "myLayer": {
            "Type": "AWS::OpsWorks::Layer",
            "Properties": {
                "StackId": {
                    "Ref": "myStack"
                },
                "Name": "MyPHPApp",
                "Type": "php-app",
                "Shortname": "php-app",
                "CustomRecipes": {
                    "Setup": [
                        "logs::config", "logs::install"
                    ]
                },
        	"EnableAutoHealing" : "true",
        	"AutoAssignElasticIps" : "false",
        	"AutoAssignPublicIps" : "true",
                "Name": "MyPHPApp"
            }

        },
        "myInstance1": {
            "Type": "AWS::OpsWorks::Instance",
            "Properties": {
                "StackId": {
                    "Ref": "myStack"
                },
                "LayerIds": [
                    {
                        "Ref": "myLayer"
                    }
                ],
                "InstanceType": "c3.large"
            }
        }
    }
}