title: Confusion with AWS --resources-to-import and --template-url
body: <p>I'm trying to import an existing S3 bucket into a newly created CloudFormation stack. As a reference, I'm using this <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-existing-stack.html" rel="nofollow noreferrer">site</a>. I use a Github workflow runner to execute this, like so:</p>
  <pre><code>      - name: Add existing S3 bucket and object to Stack
          run:  aws cloudformation create-change-set
            --stack-name ${{ env.STACK_NAME }} --change-set-name ImportChangeSet
            --change-set-type IMPORT
            --resources-to-import file://ResourcesToImport.txt
            --template-url https://cf-templates.s3.eu-central-1.amazonaws.com/ResourcesToImport.yaml
  </code></pre>
  <p>I'm a little confused to what exactly should the <em>ResourcesToImport.txt</em> and <em>ResourcesToImport.yaml</em> contain. I currently have:</p>
  <p><strong>ResourcesToImport.txt</strong></p>
  <pre class="lang-json prettyprint-override"><code>    [
        {
            &quot;ResourceType&quot;:&quot;AWS::S3::Bucket&quot;,
            &quot;LogicalResourceId&quot;:&quot;myBucket&quot;,
            &quot;ResourceIdentifier&quot;: {
              &quot;resourceName&quot;:&quot;myBucket&quot;,
              &quot;resourceType&quot;:&quot;AWS::S3::Bucket&quot;
            }
        }
      ]
  </code></pre>
  <p>NB: As a sidenote, I have just used the bucket name, but actually I just want a specific folder within that bucket.</p>
  <p><strong>ResourcesToImport.yaml</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>    AWSTemplateFormatVersion: '2010-09-09'
      Description: Import existing resources
      
      Resources:
        S3SourceBucket:
          Type: AWS::S3::Bucket
          DeletionPolicy: Retain
          BucketName: myBucket
  </code></pre>
  <p>I'm quite sure the replication of information in both of these files is redundant and incorrect. The <em>ResourcesToImport.yaml</em> file is uploaded in advance to the bucket cf-templates/ResourcesToImport.yaml</p>
  <p>What should these two files actually contain, if I am to import only an existing S3 bucket and folder?</p>
  <p><strong>EDIT</strong></p>
  <p>In addition to the template route, I also tried adding the S3 bucket via the console. However when the S3 url is added (s3://myBucket/folder1/folder2/), I get:</p>
  <pre><code>S3 error: Domain name specified in myBucket is not a valid S3 domain
  </code></pre>