Skip to content

Instantly share code, notes, and snippets.

@altmind
Created August 13, 2012 16:13
Show Gist options
  • Select an option

  • Save altmind/3342252 to your computer and use it in GitHub Desktop.

Select an option

Save altmind/3342252 to your computer and use it in GitHub Desktop.
cloudfront createDistribution
CreateDistributionResult distribution = cloudFrontClient.createDistribution(
new CreateDistributionRequest().withDistributionConfig(
new DistributionConfig()
.withCallerReference(System.nanoTime().toString())
.withAliases(
new Aliases()
.withQuantity(0)
)
.withDefaultRootObject("index.html")
.withOrigins(
new Origins()
.withItems(
[new Origin()
.withId(bucketOriginId)
.withDomainName("${bucketName}.s3.amazonaws.com")
])
.withQuantity(1)
)
.withDefaultCacheBehavior(
new DefaultCacheBehavior()
.withTargetOriginId(bucketOriginId)
.withForwardedValues(new ForwardedValues().withQueryString(false))
.withTrustedSigners(
new TrustedSigners()
.withQuantity(0)
.withEnabled(false)
)
.withViewerProtocolPolicy(ViewerProtocolPolicy.AllowAll)
.withMinTTL(0)
)
.withCacheBehaviors(
new CacheBehaviors()
.withQuantity(0))
.withComment("Distribution for bucket ${bucketName} for user ${user.email}")
.withLogging(
new LoggingConfig()
.withEnabled(false)
.withBucket("")
.withPrefix("")
)
.withEnabled(true)
)
)
@nashby

nashby commented Aug 13, 2012

Copy link
Copy Markdown

OMFG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment