by XDK
2. October 2019 10:03
Explanation:
Verify the logs at the following location to debug the instance launch
/var/log/cloud-init.log
/var/log/cfn-init.log
by XDK
18. September 2019 22:09
Explanation:
EC2 instances launched in the subnet using Terraform or Cloudformation is missing public IPv4 address
Solution:
Add the following argument/property
CloudFormation:
MapPublicIpOnLaunch - Indicates whether instances launched in this subnet receive a public IPv4 address.
PubSubnetZoneA:
Type: 'AWS::EC2::Subnet'
Properties:
AvailabilityZone:
Fn::Select:
- '0'
- Fn::GetAZs:
Ref: 'AWS::Region'
CidrBlock: '10.0.10.0/24'
MapPublicIpOnLaunch: 'True'
VpcId:
Ref: 'VPC'
Tags:
- Key: 'Name'
Value:
'Fn::Join': [ ':', [ 'Public', 'Zone A', !Ref 'AWS::StackName' ] ]
Terraform:
map_public_ip_on_launch - (Optional) Specify true to indicate that instances launched into the subnet should be assigned a public IP address. Default is false.
resource "aws_subnet" "public-subnet-a" {
vpc_id = "${aws_vpc.vpc.id}"
map_public_ip_on_launch = true
cidr_block = "10.0.10.0/24"
availability_zone = "${data.aws_availability_zones.available.names[0]}"
tags = {
Name = "public-subnet-a:${var.labname}"
}
}