Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create cloudformation script #1

Merged
merged 2 commits into from
Jun 11, 2018

Conversation

theneverstill
Copy link
Contributor

No description provided.

@theneverstill theneverstill force-pushed the feature/create-cloudformation-script branch from 9476a3a to b41ddd9 Compare June 7, 2018 19:04
@theneverstill
Copy link
Contributor Author

Right now it is missing CloudFront "error pages" configuration. We need to decide how we want to handle the following errors:

  • 400: Bad Request
  • 403: Forbidden
  • 404: Not Found (I believe for this one we're serving the contents of index.html)
  • 405: Method Not Allowed
  • 414: Request-URI Too Long
  • 416: Requested Range Not Satisfiable
  • 500: Internal Server Error
  • 501: Not Implemented
  • 502: Bad Gateway
  • 503: Service Unavailable
  • 504: Gateway Timeout

@theneverstill theneverstill force-pushed the feature/create-cloudformation-script branch from b41ddd9 to cf8c245 Compare June 7, 2018 19:13
@theneverstill
Copy link
Contributor Author

theneverstill commented Jun 7, 2018

Despite CloudFront AND S3 allowing a number of symbols in their bucket directory names (cloudfront: origin path).. I tried the following combination for a base path:

/a-zA-Z0-9_.;:!@$&()=+-/a-zA-Z0-9_.;:!@$&()=+-

Even though it worked for the cloudformation script (with a successful deployment) and maintained the value... it doesn't serve the page. I believe I'll tighten up the OriginPath regex unless anyone has any objections.

The resulting url: /a-zA-Z0-9_.%253B%253A*!%2540%2524%2526()%253D%252B-/a-zA-Z0-9_.%253B%253A*!%2540%2524%2526()%253D%252B-/

@theneverstill
Copy link
Contributor Author

That fix did the trick. The following OriginPath works just fine: /a-zA-Z0-9_.!()-/a-zA-Z0-9_.!()-

Copy link
Contributor

@facundovictor facundovictor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theneverstill Nice work!
I left some comments that I think we could apply before merging it. Or we can handle them as separate PRs.
For now I think it is enough for a first version.

S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Join ["", [!Ref "Subdomain", ., !Ref "Domain"]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in other places I think we could use !Sub instead of !Join, like

BucketName: !Sub "${Subdomain}.${Domain}"

Enabled: true
HttpVersion: http2
IPV6Enabled: false
PriceClass: PriceClass_All
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PriceClass should be a parameter --> https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html

From https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html:

Valid Values: PriceClass_100 | PriceClass_200 | PriceClass_All

DistributionConfig:
Aliases:
- !Join ["", [!Ref "Subdomain", ., !Ref "Domain"]]
DefaultRootObject: index.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default root object should be also a parameter with the default value set to index.html.

ViewerCertificate:
AcmCertificateArn: !Ref AcmCertificateArn
MinimumProtocolVersion: TLSv1.2_2018
SslSupportMethod: sni-only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for now, but we should see if we want to configure it in another more flexible way.

@theneverstill theneverstill merged commit 212d7d6 into master Jun 11, 2018
@theneverstill theneverstill deleted the feature/create-cloudformation-script branch June 11, 2018 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants