I want to use multiple templates which will have multiple templates file directory and structure in cloudformation I don’t want to use s3 bucket cause there will be multiple files later and I will use ci-cd pipeline to deploy my changes this is my file i am trying to deploy in cloudformation
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS EC2 Backup Policy for Production Environment
Resources:
EC2LifecycleManagerStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: common/ec2/lifecyclemanager.yaml
Parameters:
RetentionPeriodDay: 5
RetentionPeriodWeek: 2
RetentionPeriodMonth: 2
TargetResourceTags: FRONT
PolicyDescription: Production Backup Policy
RetentionTimeDay: '05:00'
RetentionTimeWeek: '23:00'
RetentionTimeMonth: '00:00'
this lifecycle manager policy contains some backup policy and schedules for the my ec2 instances so I want to utilize this prod.yaml file cause i will have multiple files and nested stacks. Is there any way to do this without s3? Here is what I tried using bash script
#!/bin/bash
TEMPLATE_FILE="root.yaml"
CAPABILITIES="CAPABILITY_NAMED_IAM"
PROFILE="nit-iam"
STACK_NAME='PROD-INFRA'
CHANGE_SET_NAME='PROD-CHANGE'
#
AWS_PROFILE=$PROFILE aws cloudformation create-change-set
--stack-name $STACK_NAME
--change-set-name $CHANGE_SET_NAME
--template-body file://$TEMPLATE_FILE
--capabilities CAPABILITY_NAMED_IAM
--change-set-type CREATE
echo "Waiting for change set to be created..."
AWS_PROFILE=$PROFILE aws cloudformation wait change-set-create-complete
--stack-name $STACK_NAME
--change-set-name $CHANGE_SET_NAME
# Execute Change Set
echo "Executing change set..."
AWS_PROFILE=$PROFILE aws cloudformation execute-change-set
--stack-name $STACK_NAME
--change-set-name $CHANGE_SET_NAME
But this script is also failing saying template url must be supported url is there any way to do this?