Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save altmind/3342325 to your computer and use it in GitHub Desktop.
cloudfront-createDistribution-correct
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")
.withS3OriginConfig(new S3OriginConfig()
.withOriginAccessIdentity("")
)
])
.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)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment