title: How to programmatically get 'distribution-id' to invalidate cloudfront cache?
body: <p>Need to programmatically get the CDN_DISTRIBUTION_ID so that CloudFront caches can be invalidated post-build regardless of distribution. </p>
  
  <p>I've got cloudfront to invalidate as intended but it requires a distribution id. Since same yaml code is going to be used for each developers' individual environment, ci, production, etc it needs to be gotten programmatically. 
  I'm struggling to figure out how to get the distribution_id without manually finding it in the AWS console, or using workarounds in other languages. We would like to be able to just pass it in as a variable like ${DISTRUBUTIION_ID} but I'm struggling to figure out how to get set that through yaml.  </p>
  
  <pre><code>- aws cloudfront create-invalidation --distribution-id CDN_DISTRIBUTION_ID --paths "/*"
  </code></pre>
  
  <p>I've got the ID to be a stack import but I'm unsure on how to import it into the run time build spec where it needs to be.</p>
  
  <pre><code>Outputs:
    ClientDistribution:
      Description: "ClientDistribution distribution id"
      Value: !Ref ClientDistribution
      Export:
        Name: !Sub "${AWS::StackName}-ClientDistribution"
  </code></pre>