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 :)
Related
Hope you can help with, we are building a new customer portal and would like to use Azure B2C for various reasons including the need to interface with MS Dynamics CE. However, our tech stack is PHP, Slim to be precise.
Does anyone have experience of delivering a fully functioning production app with this configuration?
Would love to hear from you and have your assistance.
Please get in touch.
Thanks, Duong.
To deploy the PHP Web Application using Azure AD B2C,follow the below steps :
Install PHP, Laravel (it's web framework).
Create a Web App in Azure Portal B2C blade by noting the ClientID and Client Secret from the Application.
Clone and customize the source code from github: git clone https://github.com/Azure-Samples/active-directory-b2c-php-webapp-openidconnect.git
Download the latest version of the php security library in your repo.
To deploy into Azure, you need to set-up the Deployment settings by selecting Local Git Repository and setting up the username and password for deployment.
git init and git remote add azure [deployment url] commands are used to set up deployment to azure.
git push azure master to deploy online.
Instead of depending on their own code, developers can rely on B2C for consumer sign up and sign in.
Using OpenID Connect, we can validate the authentication token of the users connected with the Azure B2C of the PHP Web Application.
Please refer this GitHub article for code and more information.
I've implemented B2C integration on Azure with a Slim 4 application, what is it you need to know?
In short:
Set up B2C in Azure
Set up Client ID en Secret in external provider and store in Azure Key Vault
Create a middleware service that looks for the client token in requests for the routes you want to protect
I haven't written a blog about it yet, but expect one in March at www.azurephp.dev with a working example using Slim 4. In the mean time, I hope this short answer works for you. If not, ping me.
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
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 am in a process of setting up Prestashop installation in a cluster of 3 GCE instances, managed by Kubernetes. I use Cloud SQL as DB and all seems to be running well, except, of course the images part, since prestashop in each pod uploads and shows images to/from it's local filesystem.
In App Engine I cloud use stream_context_set_default() and that would allow me to use "gs://mybucket" as a regular path. Is there a way to do that in Compute Engine? If it is possible, making Prestashop use Cloud Storage bucket can be done in 2 lines of code.
There is a StreamWrapper for Amazon S3 service that does exactly what I need: http://hiousi.tumblr.com/post/94824087894/prestashop-images-hosted-on-amazon-s3
But I would like to use Cloud Storage.
The source code for the stream wrapper can be downloaded at https://github.com/GoogleCloudPlatform/appengine-php-sdk/tree/master/google/appengine/ext/cloud_storage_streams.
It has a couple of dependencies on other GAE APIs such as App Identity & Urlfetch. They may need to be stubbed out or replaced by equivalent services on GCE.
i have created a PHP StreamWrapper for Google Compute Engine, if you're still interested. Here is the link to my adapted version.
https://github.com/jimyaghi/GCECloudStorageStreamWrapper
Sorry it's not more friendly, but it's a good useful bit of work. i'm using it and it works great.
I want to host an Azure Website and I need to run a PHP script on the site every hour. Usually I would do something like this using cron jobs. Is Azure WebJobs via Azure Scheduler the only option to accomplish this?
Using PHP or a REST API via PHP cURL, how do I create and deploy an Azure cloud service worker role to run some back-end PHP software independent of the website?
How would pricing work for the cloud service? Would I only be paying while it is deployed, or would I be paying when it is created also? E.g. Could I create the service via Azure portal and deploy via PHP to get same pricing with less coding?
How do I stop a cloud service once it is done processing?
You can use the Azure WebJobs under the website as you pointed out. You can also use the Azure scheduler direct and have it fire a call to another website or even an external system somewhere to kick something off. There is also a scheduler in the Azure Marketplace you could look at. Another option is the Azure Automation, which allows you to run a script separate from a web site or other deployment, though is PowerShell.
You can create deployments using the Azure Management REST API. Here is some documentation on how to use the API from PHP. As for running this independent from the website, you'd either need to run this from an external system, or from a VM running within Azure.
You pay for the Cloud Service from time it starts its deployment until the deployment is deleted. You pay only when something is deployed to the Cloud Service. If you create a cloud service via the portal or script, but don't deploy anything, then you aren't charged anything. When you deploy something into the cloud service you will be charged for as long as the deployment is there.
Based on this question I'm assuming you mean the cloud service is some sort of back end processing. You could have the cloud service use the management api to shut itself down, but that would require that the management certificate be deployed with the cloud service, which some people don't like to do for security reasons. Other folks would have the worker roles push messages to an external system, or another service running in Azure, to say that they are done and it would then reach out and shut them down. There are really several options here depending on if you want it all managed in the cloud or have resources elsewhere that would perform the shutdown. The link to the management APIs above will give you "how to" shut them down, but the decision on what does that is really pretty open.