currently I try to simply spin up an ec2 instance to show myfile2.txt in the tmp folder currently the cloud formation launches. but no file. I have tried working around in the command line and check the logs but I don't see what the issue is I've been having trouble with AWS::CloudFormation::Init: for a while and was wondering if anyone had any suggestions??
This is a just simple exercise that is part of a greater project.
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
InstanceTypeParameter:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- m1.small
- m1.large
Description: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.
KeyName:
Description: key pair name
Type: AWS::EC2::KeyPair::KeyName
Resources:
WebInstance:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
config:
files:
'/tmp/myfile2.txt':
content: "Hello sir"
mode: '000755'
owner: root
group: root
Properties:
InstanceType:
Ref: InstanceTypeParameter
ImageId: ami-04b762b4289fba92b
SecurityGroupIds:
- sg-0394c353eef246c71
SubnetId: subnet-476a773e
Tags:
-
Key: Name
Value: Trovo-webserver
KeyName:
Ref: KeyName
UserData:
Fn::Base64:
!Sub |
#!/bin/bash -xe