Since some weeks ago, I've been studying a lot about AWS. Recently, I've been running some tests with Auto Scaling for EC2, using applications with HTML front end and JS back end. So far, I've been using S3 to create an URL in which users can access the HTML front end. The HTML is connected to an Elastic Beanstalk instance's endpoint, allowing me to send requests to my EC2 instances, already auto scaled and connected to a RDS instance. It's a simple architecture, allowing my users to access the site, require data and get the response, with the Auto Scaled EC2 keeping a good relation between my costs and my app's performance;
Recently, though, I was requested to develop a similar system, but for a Wordpress site. Problem here is, since Wordpress is basically PHP, I wouldn't be able to use S3 properly. So, my question basically is: how could I develop an Auto Scaling system in Amazon AWS for my Wordpress site, preferably without using Elastic Beanstalk (since my boss is afraid it can get too expansive)? It's important to notice that the site has constant updates in its content. If possible, I would like to use a similar architecture to the one I developed, but I'm okay if that's not possible.
Elastic Beanstalk does not have a cost for itself, just the services that you use. For your use case EB is just fine.
The key with Wordpress (build your own or EB) is to separate the database from the EC2 instances. Auto Scaling will launch and terminate instances using a precofigured AMI that you specify. The database needs to be independent from the EC2 instances. I recommend RDS for this for high availability and fault tolerance.
There are numerous articles on the Internet for AWS and Wordpress. You can even use CloudFormation to build everything for you. Here are some links to get you started:
Installs and deploys WordPress on to Amazon EC2 instances in an Auto Scaling group with a multi-AZ Amazon RDS database instance for storage.
Cloudformation Wordpress + Auto Scaling + RDS
Deploying a High-Availability WordPress Website with an External Amazon RDS Database to Elastic Beanstalk
Elastic Beanstalk + WordPress + Auto Scaling + RDS
Related
I have to create an API (JSON REST) for a project that has recently moved onto AWS, with a PHP CodeIgniter code-base, and an RDS database.
I have a bit of a dilemma, because I'm unsure what route to take to create the API. My two options seem to be:
Create an API with CodeIgniter Rest Server
Use AWS, using a combination of Lambda and the API Gateway to GET and POST to my RDS database.
The paramount priority is security, so that points towards using AWS, as far as I understand, but after failing in my attempt to make a small scale mock-up on AWS, I'm left a bit confused.
I wondered if anybody had any input as this is somewhat of a niche question, and I've had no interaction with AWS or CodeIgniter Rest Server.
Thank you for your time!
I can help you in a bit since I've experience with deploying Codeigniter base web system onto AWS.
First of all, the security in questions... AWS wont help much. Yes, it is by default have more security layer. But it is no use if your application itself is not secured.
So here goes:
If you want to deploy fast, I'd suggest go through EC2, install one of the image that have LAMP configured (from market, should've free image that you can use)
Upload to the server, configure the right config
Then it should work as per what it is intended.
But if you want to utilized auto scaling features
Setup the Elastic Beanstalk (EB) for PHP environment
ZIP up the codeigniter source code with all setting configured as below
Database setting point to RDS
Session to use database driver and create the needed table in the RDS
Upload and deploy to the EB
Then hopefully everything is working fine
Then, if to use API Gateway & Lambda, you will actually need to learn a bit more things.
How to configure API Gateway, to get familiar with how to use it
How to "link" it to lambda
How Lambda need to read request & response back etc
Also on Lambda no PHP support yet, so need to learn nodejs/python etc in order to use it
Basically if want to use API Gateway & Lambda you might need to start the development from scratch.
I have developed an Android app which does a GET/PUT operations with a test web server for fetching and storing data in JSON format. For PUT using a PHP script on webserver via parameters in url. Now to scale the solution, i am exploring AWS solutions. How to achieve PHP script based logic handling on webserver with AWS S3 or any other cloud based storage which can perform this php based logic handling.
I would recommend to use AWS Lambda- It doesn't need servers to be hosted and maintained, which is a big headache. With AWS Lambda, in few minutes you can get your web application running. Your PHP scripts can be hosted as service and AWS will take care of its scalability and availability.
https://www.youtube.com/watch?v=eOBq__h4OJ4
https://aws.amazon.com/serverless/build-a-web-app/
https://aws.amazon.com/blogs/compute/scripting-languages-for-aws-lambda-running-php-ruby-and-go/
AWS S3 you can use for storing your static files like images, css, javascript etc...
I'm designing a SAAS application, which will be hosted on AWS. Previously I have used Elastic Beanstalk to manage applications. I could design the app so that all clients share single DB (that should be easy using EB). Is there a way to have a separate database for each client?
I could use environments for that (which doesn't seem to be a good idea since environments aren't meant for that), or create a separate beanstalk app for each client (I'm not sure if that wouldn't make updates more of a hassle).
I could also put EB aside and use different AWS services altogether.
My question is - can EB be used to create a multi-tenant SAAS app with isolated databases, or am I locked with a shared solution (single app, single db)?
If your customers are "come to my site, sign-up, start using", then build it as a single-app, using a single db. Design your database and app to be multi-tenant properly segregating data with built-in authorization checks.
If your SaaS architecture uses EB environments or databases based on customer, then:
You'll have to pay for resources per customer. That includes EC2 instances, RDS instances, etc.
When a customer signs-up, they'll need to wait for these resources to initialize. This delay may cause them to go elsewhere and not come back.
As your customer-base grows, so will your resources. Updates will take longer to apply.
I wouldn't consider a multi-tenant database architecture as being "locked in". I consider it "the right thing" as long as it's designed properly.
I am trying to add my application to amazon aws using the Beanstalk API.
I have a few webpages along with a backend in php and database in MYSQL which is called from the webpages using AJAX.
I want to deploy this on Amazon aws using the Beanstalk API and loadbalance it using the LoadBalancing API. I don't seem to find any tutorial online which would help me host my application.
Can someone guide me to how I should go about deploying my application ?
Amazon Elastic Beanstalk for PHP is somehow documented here.
As for your setup, here are the basic steps:
1. create an RDS instance manually. don't set Elastic Beanstalk do it for you as it poorly manages it. in the Beanstalk setup wizard make sure you use your preset RDS and not let the wizard create one.
2. start the Elastic Beanstalk wizard, define it as a web server and ensure the Environment type is Load Balancing, autoscaling. This will automatically create the load balancing configuration so don't worry about that.
3. from there I'd recommend continuing with the sample application just to make sure everything is setup correctly.
4. After the application launches and you're able to access it from the web, you should go ahead and git aws.push your own application. some doc here.
A fair warning - Amazon Elastic Beanstalk isn't easy to set up. If you are signed up to their support - use it. a lot :)
Hi I'm really new to amazon s3. I want to download a file to my server (which is in s3) from a given another s3 location (credentials will be provided). This must be done using a php (cakephp 1.2) method and there is no user interface for this. (this could be a cron job probably). I couldn't find any good article regarding this by googling. Any sample code that I can do this work?
Check out AWS SDK for PHP.
If I understand you correctly, you want to copy an Amazon S3 object (file) from one AWS account to a different AWS account without downloading and uploading it to a separate system (apparently an Amazon EC2 instance)?!
It is possible to copy an object within a single account by means of copyObject(), but cross account operations aren't supported by this API (and neither for any other AWS resources, as far as I know, which is likely a deliberate decision to ease and streamline the security architecture and process).
So while your use case is sound, there is no other solution than channeling this process through your server, i.e. download from the source account and upload to the target account.
This shouldn't be much of a problem cost or performance wise though, because There is no Data Transfer charge between Amazon EC2 and other Amazon Web Services within the same region (i.e. between Amazon EC2 US West and Amazon S3 in US West) (see section Data Transfer in Amazon EC2 Pricing) and these operations will facilitate Amazon's decent internal network infrastructure (rather than crossing the public internet).