-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
462070e
commit 0625e33
Showing
3 changed files
with
59 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
|
||
import aws_cdk as cdk | ||
|
||
from sssi.sssi_stack import SssiStack | ||
|
||
|
||
app = cdk.App() | ||
SssiStack(app, "SssiStack", | ||
# If you don't specify 'env', this stack will be environment-agnostic. | ||
# Account/Region-dependent features and context lookups will not work, | ||
# but a single synthesized template can be deployed anywhere. | ||
|
||
# Uncomment the next line to specialize this stack for the AWS Account | ||
# and Region that are implied by the current CLI configuration. | ||
|
||
#env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')), | ||
|
||
# Uncomment the next line if you know exactly what Account and Region you | ||
# want to deploy the stack to. */ | ||
|
||
#env=cdk.Environment(account='123456789012', region='us-east-1'), | ||
|
||
# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html | ||
) | ||
SssiStack(app, "SssiStack") | ||
|
||
app.synth() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,65 @@ | ||
from aws_cdk import ( | ||
# Duration, | ||
Stack, | ||
# aws_sqs as sqs, | ||
) | ||
from aws_cdk import Stack | ||
from aws_cdk import aws_certificatemanager as acm | ||
from aws_cdk import aws_cloudfront as cloudfront | ||
from aws_cdk import aws_s3 as s3 | ||
import aws_cdk as cdk | ||
from constructs import Construct | ||
|
||
class SssiStack(Stack): | ||
|
||
# Old DNS 13.54.216.29 | ||
|
||
class SssiStack(Stack): | ||
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: | ||
super().__init__(scope, construct_id, **kwargs) | ||
|
||
# The code that defines your stack goes here | ||
# Create an S3 bucket called sssi.org.au with a redirect to https://geospatialcouncil.org.au | ||
sssi_bucket = s3.Bucket( | ||
self, | ||
"sssi.org.au.bucket", | ||
bucket_name="sssi.org.au", | ||
website_redirect=s3.RedirectTarget( | ||
host_name="geospatialcouncil.org.au", | ||
protocol=s3.RedirectProtocol.HTTPS, | ||
|
||
), | ||
removal_policy=cdk.RemovalPolicy.DESTROY | ||
) | ||
|
||
# Set up an ACM certificate for sssi.org.au | ||
sssi_cert = acm.Certificate( | ||
self, | ||
"sssi.org.au.cert", | ||
domain_name="sssi.org.au", | ||
validation=acm.CertificateValidation.from_dns(), | ||
) | ||
|
||
# example resource | ||
# queue = sqs.Queue( | ||
# self, "SssiQueue", | ||
# visibility_timeout=Duration.seconds(300), | ||
# ) | ||
# Set up cloudfront distribution for sssi.org.au | ||
cloudfront.CloudFrontWebDistribution( | ||
self, | ||
"sssi.org.au.distribution", | ||
origin_configs=[ | ||
cloudfront.SourceConfiguration( | ||
custom_origin_source=cloudfront.CustomOriginConfig( | ||
domain_name=sssi_bucket.bucket_website_domain_name, | ||
origin_protocol_policy=cloudfront.OriginProtocolPolicy.HTTP_ONLY, | ||
), | ||
behaviors=[ | ||
cloudfront.Behavior( | ||
is_default_behavior=True | ||
) | ||
], | ||
) | ||
], | ||
viewer_certificate=cloudfront.ViewerCertificate.from_acm_certificate( | ||
certificate=sssi_cert, | ||
aliases=["sssi.org.au"], | ||
), | ||
price_class=cloudfront.PriceClass.PRICE_CLASS_ALL, | ||
error_configurations=[ | ||
cloudfront.CfnDistribution.CustomErrorResponseProperty( | ||
error_code=404, | ||
response_code=404, | ||
response_page_path="/404.html", | ||
) | ||
], | ||
) |