I am having trouble with aws cloud formation. I need to create cloudformation that will install and configure RDS with RHEL and mariadb with route 53 and master user. I started first with basic config.yaml but i am getting an error with vpc, it says
No default VPC for this user (Service: AmazonEC2; Status Code: 400; Error Code: VPCIdNotSpecified; Request ID: 407bd74c-9b85-4cce-b5a7-b816fe7aea15)
My config.yaml is this
Resources: Ec2Instance1: Type: 'AWS::EC2::Instance' Properties: SecurityGroups: - !Ref InstanceSecurityGroup KeyName: adivir ImageId: ami-07dfba995513840b5 AvailabilityZone: eu-central-1 InstanceType: t2.micro UserData: Fn::Base64: !Sub | #!/bin/bash -xe yum install -y httpd yum install -y git yum install -y php php-mysql git clone https://github.com/demoglot/php.git /var/www/html systemctl restart httpd systemctl enable httpd Ec2Instance2: Type: 'AWS::EC2::Instance' Properties: SecurityGroups: - !Ref InstanceSecurityGroup KeyName: adivir ImageId: ami-07dfba995513840b5 AvailabilityZone: eu-central-1 InstanceType: t2.micro UserData: Fn::Base64: !Sub | #!/bin/bash -xe yum install -y httpd yum install git -y git clone https://github.com/demoglot/php.git /var/www/html systemctl restart httpd systemctl enable httpd InstanceSecurityGroup: Type: 'AWS::EC2::SecurityGroup' Properties: GroupDescription: Enable SSH access SecurityGroupIngress: - IpProtocol: tcp FromPort: '2256' ToPort: '2256' CidrIp: 0.0.0.0/0 - IpProtocol: tcp FromPort: '80' ToPort: '80' CidrIp: 0.0.0.0/0 ElasticLoadBalancer: Type: 'AWS::ElasticLoadBalancing::LoadBalancer' Properties: AvailabilityZones: - eu-central-1 - eu-central-1b Listeners: - InstancePort: '80' LoadBalancerPort: '80' Protocol: HTTP HealthCheck: Target: 'HTTP:80/' HealthyThreshold: '3' UnhealthyThreshold: '5' Interval: '30' Timeout: '5' Instances : - !Ref Ec2Instance1 - !Ref Ec2Instance2 DBSECURITYGROUP: Type: 'AWS::RDS::DBSecurityGroup' Properties: GroupDescription: Security Group for RDS private access DBSecurityGroupIngress: - CIDRIP: 0.0.0.0/0 MyDB: Type: 'AWS::RDS::DBInstance' Properties: DBName: kk AllocatedStorage: '20' DBInstanceClass: db.t2.micro Engine: MariaDB EngineVersion: '10.1.31' MasterUsername: admin MasterUserPassword: admin123 DBSecurityGroups: - !Ref DBSECURITYGROUP Tags: - Key: name Value: kk DeletionPolicy: Snapshot
What i need to do in order to resolve vpc error and have RDS create successfully and how and where to add route 53 creation in yaml file? Also database neds to be connected to java app athat is on other instance. What do i need to share with person making app in order for him to connect to database? Also, is it possible to have one shell script that will run cloudformations in order, create stacks and then exit so that not each team member needs to run his own cloud formation? Thank you