Skip to content

Instantly share code, notes, and snippets.

@joonathan
Forked from harperreed/create_custom_origin.py
Created January 15, 2011 14:49
Show Gist options
  • Select an option

  • Save joonathan/780952 to your computer and use it in GitHub Desktop.

Select an option

Save joonathan/780952 to your computer and use it in GitHub Desktop.

Revisions

  1. @harperreed harperreed revised this gist Jan 14, 2011. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions invalidate_cf_cdn.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    import datetime
    from boto.cloudfront import CloudFrontConnection

    AWS_CF_DISTRIBUTION_ID = 'LKJHSADLIUYWE(*&QW(E*'

    files = ['/css/style.css','/filename/otherfile.name' ]

    conn = CloudFrontConnection()
    print conn.create_invalidation_request(AWS_CF_DISTRIBUTION_ID, files)
  2. @harperreed harperreed created this gist Jan 14, 2011.
    16 changes: 16 additions & 0 deletions create_custom_origin.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    import boto
    # requires cf_customorigin branch
    # https://github.com/boto/boto/tree/cf_customorigin

    origin_domain = 'www.example.org'
    cdn_cname = ['media.example.org']
    caller_reference = 'exmaple Distribution'

    c = boto.connect_cloudfront()
    d = c.create_custom_distribution(
    dns_name=origin_domain,
    enabled=True,
    caller_reference=caller_reference,
    cnames=cdn_cname
    )
    print 'cname '+ cdn_cname + ' to ' d.domain_name