Skip to content

Instantly share code, notes, and snippets.

@gcanales75
Created June 16, 2016 23:47
Show Gist options
  • Select an option

  • Save gcanales75/e7cd1ec6e0aeb81f9bce15f1741ed086 to your computer and use it in GitHub Desktop.

Select an option

Save gcanales75/e7cd1ec6e0aeb81f9bce15f1741ed086 to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Crear una instancia EC2 y la configura para CloudWatch Logs",
"Resources" : {
"EIP" : {
"Type" : "AWS::EC2::EIP",
"DependsOn" : "SyslogEC2",
"Properties" : {
"Domain" : "vpc-ec29d988",
"InstanceId" : { "Ref" : "SyslogEC2" }
}
},
"SyslogEC2" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"InstanceType" : "t2.micro",
"AvailabilityZone" : "us-east-1d",
"ImageId" : "ami-fce3c696",
"NetworkInterfaces" : [{
"AssociatePublicIpAddress" : "false",
"DeviceIndex": "0",
"SubnetId" : "subnet-563f3a21",
"GroupSet" : ["sg-400b6f3b"]
}],
"UserData" : { "Fn::Base64": { "Fn::Join" : [ "" , [
"#!/bin/bash\n",
"apt-get update -y\n",
"curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O\n",
"chmod +x ./awslogs-agent-setup.py\n",
"./awslogs-agent-setup.py -n -r us-east-1 -c s3://gil-cloudwatch-log-config-file/awslogs-hma.cfg\n"
]]} },
"IamInstanceProfile" : "aws-logger-role-EC2" ,
"Tags" : [
{ "Key" : "Name" , "Value" : { "Ref" : "AWS::StackName"} },
{ "Key" : "Cuenta" , "Value" : "HMA" }
],
"KeyName" : "default-test-infragig"
}
}
}
}
@gcanales75
Copy link
Author

CloudFormation Template para lanzar instancia EC2, asignarle rol para poder crear Log Stream en CloudWatch y redireccionar logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment