Reputation: 864
I'm thinking in using CloudFront for dynamic content in combination with an Elastic Beanstalk application.
I like the features that Elastic Beanstalk offers (git deployments, automatic capacity provisioning, load balancing, auto-scaling, and application health monitoring) and I also like the new features that CloudFront introduced last week ( http://bitly.com/aws-cloudfront-dynamic ), so I was thinking on using CloudFront on front of my Elastic Beanstalk application.
What you think?
Is that a good approach? (see a simple diagram here: http://d.pr/i/f6sa )
or should I use normal EC2 instances and LoadBalancer (Maybe using a CloudFormation setup)?
If I use CloudFront in combination with Elastic Beanstalk, should I point the CloudFront origin to the Elastic LoadBalancer that Beanstalk automatically created for my application (ie: awseb-My-Environment-00000.us-east-1.elb.amazonaws.com) that I believe it could change if an environment fails and it automatically it creates a new one or should I point the origin to the app URL (ie: http://myapp.elasticbeanstalk.com ) that should always be the same?
Recommendations welcome!
Thanks!
Upvotes: 4
Views: 3167
Reputation: 31570
You can use ebextensions to modify the underlying CF template: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions-otherkeys.html
This is the only way I see this working correctly with EB because as you said it creates ELBs dynamically- manually pointing to one of those would be a bad idea.
What I would try to do is see if it's possible to create a CloudFront distribution in that template and point it to the dynamically created ELB- not sure that's possible.
Maybe someone from Amazon can chime in?
Upvotes: 0
Reputation: 1345
Although your question is rather dated I thought I'd comment on your solution as I believe that you wouldn't need to use Cloudfront in front of Elastic Beanstalk for two reasons.
If you require speed then use Cloudflare as a reverse proxy and make sure your RDS servers are in the same zone as your EB instances. You can also store your static assets (i.e. images, css, js) in S3 and serve it via CF.
I am interest in your eventual solution or did you abandon it completely?
Upvotes: 2
Reputation: 3609
CF is definitely the way to go, both as a CDN as well as a reverse proxy.
I'm not sure how is it working with PHP and .NET (I'm a Java Dino), but if your environment tends to fail, I suggest you combine the Zero Downtime Feature with a Dual Environment
(switching the DNS CNAME among those, perhaps after a quick smoke test when releasing) in order to help you minimize impact on those issues, so its just a process issue.)
Upvotes: 1