Package: cfnexec
cfn-execThis is Wrapper tool for aws cloudformation create stack.InstallationOpen AWS Cloudshell or any terminal configured with aws cli.Install cfn-execpip3installcfnexecCreate stack with CFn file or url and parameter file or urlcfn-exec-n$your_stack_name-i$your_cfn_url-p$your_cfn_parameter_urlnote: If you are using the nested call function of Cloudformation, you need to make the called file accessible in advance.cli optionsusage:cfn-exec[-h][-iINPUT_PATH][-nSTACK_NAME][-pPARAM][--role-arnROLE_ARN][-s3S3_BUCKET_URL_PARAMETER_KEY_NAME][-csf][-dr][-del][-v][-V]optionalarguments:-h,--helpshowthishelpmessageandexit-iINPUT_PATH,--input-pathINPUT_PATHCloudformationfileurlpathhavingCloudformationfiles.Supportedyamlandjson.Ifthispathisafolder,itwillbedetectedrecursively.-nSTACK_NAME,--stack-nameSTACK_NAMEThenamethat's associated with the stack. The namemust be unique in the Region in which you are creatingthe stack.-p PARAM, --parameter-file PARAMParameter file--role-arn ROLE_ARN   The Amazon Resource Name (ARN) of an Identity andAccess Management (IAM) role that CloudFormationassumes to create the stack. CloudFormation uses therole'scredentialstomakecallsonyourbehalf.CloudFormationalwaysusesthisroleforallfutureoperationsonthestack.Providedthatusershavepermissiontooperateonthestack,CloudFormationusesthisroleeveniftheusersdon't have permissionto pass it. Ensure that the role grants leastprivilege. If you don'tspecifyavalue,CloudFormationusestherolethatwaspreviouslyassociatedwiththestack.Ifnoroleisavailable,CloudFormationusesatemporarysessionthat'sgeneratedfromyourusercredentials.-s3S3_BUCKET_URL_PARAMETER_KEY_NAME,--s3-bucket-url-parameter-key-nameS3_BUCKET_URL_PARAMETER_KEY_NAMESettheparameterkeynametothis,iftheinputpathisalocalfileandyouwanttoreflecttheS3bucketnametobeuploadedintheparameter.-csf,--change-set-force-deployWhenthetargetStackalreadyexistsandistobedeployedasachangeset,enablingthisoptionwillapplythechangesettothestackasis.-dr,--disable-rolebackDisablerollbackonstackcreationfailure.-del,--delete-stackAftercreatingastack,thestackisdeletedregardlessofsuccessorfailure.-v,--versionShowversioninformationandquit.-V,--verbosegivemoredetailedoutputparameter file formatSupport "Cloudformation official format" or "Simple format"Cloudformation official format[{"ParameterKey":"ParameterKeyName1","ParameterValue":"ParameterValue1"},{"ParameterKey":"ParameterKeyName2","ParameterValue":"ParameterValue2"},...],----ParameterKey:ParameterKeyName1ParameterValue:ParameterValue1-ParameterKey:ParameterKeyName2ParameterValue:ParameterValue2...Simple format{"ParameterKeyName1":"ParameterValue1","ParameterKeyName2":"ParameterValue2",...}---ParameterKeyName1:ParameterValue1ParameterKeyName2:ParameterValue2...Nested TemplateIf the --input-path Cloudformation template has a nested structure that references another template, note the followingIf --input-path is set by URL, all referenced templates must have been placed at the referenced URL in advance.If --input-path is set as a local file, the referenced template must be located under the folder where the target local file is located. Also, the referenced URL must be able to be changed via parameters.Reference to local files with nested structureThis is a reference example of a Cloudformation file with a nested structure set by --input-path.AWSTemplateFormatVersion:"2010-09-09"Description:main.ymlParameters:TemplateS3BucketURL:Description:Referenced S3 bucket URLType:StringDefault:TemplateS3BucketURLBucketName:Type:StringDefault:BucketNameResources:# Create S3 BucketS3:Type:AWS::CloudFormation::StackProperties:TemplateURL:!Sub${TemplateS3BucketURL}/components/s3.ymlParameters:BucketName:!RefBucketNameThis is a reference example of a Cloudformation file with a nested structure set by --input-path.AWSTemplateFormatVersion:"2010-09-09"Description:s3.ymlParameters:BucketName:Type:StringDefault:"BucketName"Resources:S3Bucket:Type:AWS::S3::BucketProperties:BucketName:!RefBucketNameThis is an example of a parameter file.TemplateS3BucketURL:TemplateS3BucketURLBucketName:cfnexec-example-test-01234567890123456789This is the folder tree of the local file..
└── example
    ├── param.yml
    └── input
        ├── main.yml
        └── components
            └── s3.ymlThis is an example of execution.cfn-exec-nexample-stack-i./example/input/main.yml-p./example/param.yml-s3TemplateS3BucketURLUsageSupported Cloudformation and parameter files are written in json or yaml format, and can be located at local, S3, or public URLs.local filecfn-exec-nexample-stack-i./example/input/main.yml-p./example/param.ymls3 filecfn-exec-nexample-stack-ihttps://yourbucket.s3.us-east-1.amazonaws.com/main.yml-phttps://yourbucket.s3.us-east-1.amazonaws.com/param.ymlpublic filecfn-exec-nexample-stack-ihttps://raw.githubusercontent.com/youraccount/yourrepo/main/input/main.yml-phttps://raw.githubusercontent.com/youraccount/yourrepo/main/param.yml