I'm playing around with Elastic Beanstalk and I'm trying to figure out how I might add background-workers to my application.
Is there an easy way to launch an EC2 instance with the code that's on my elastic beanstalk application servers? And have the deploy mechanism that comes with Elastic beanstalk update these instances?
I am sorry I really have no idea about workers
But You can use AMAZON SDK and build an application to launch an ec2 instance based on regions and also you can specify AMI too , so there are various api calls from which you could get available regions , and also you can decide or building your own AMI with the required specification .
Related
I'm an AWS newbie and I can't seem to find a good example. There are plenty of static website examples for S3, but my site needs to run a fairly simple PHP script which then means I need to be on EC2.
I used Elastic Beanstalk to create an EC2 instance and it added a simple PHP example, so when I go to the public DNS address in a browser, I see the example PHP script run. So far, so good.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
So, how do I upload an html website to run on this instance and still get a PHP script to run?
Sorry if I have some of the terminology or methodology wrong.
Thank you.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
They probably are but in a ZIP package. You don't modify anything on the fly. You're supposed to modify your source code on a local machine, "bundle" it in a ZIP file and then either
Upload with AWS Console.
Upload it to S3, create an application version with AWS CLI and then deploy (also with AWS CLI).
Docs are here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_eb.html
It is possible to change your application by connecting to an EC2 instance, but your changes will be lost during redeployment, scaling etc.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
When you created your Elastic Beanstalk environment you were asked for 'EC2 key pair'. You should use that exact SSH key to connect to your instance. This step is optional, so it is possible that you skipped it and created an environment without a key. In this case there is no way to connect to your EC2 instance (almost). You'll have to upload an SSH key (EC2 dashboard -> NETWORK & SECURITY -> Key Pairs) and create a new environment.
I'm a beginner on cloud providers, and I have a website to deploy. The website is made with PHP, HTML, CSS and Javascript, and it uses an API developed on NodeJS to access a database.
Is there a way to deploy all of this (Inteface + NodeJS API) on one AWS Elastic Beanstalk application? Or should I deploy only the API on AWS Elastic Beanstalk and deploy the website's interface with other AWS solution, e.g. a static website on Amazon S3.
I'm really lost on so many solutions, can someone give me some tips on this scenario?
One solution is you can deploy PHP application using Elastic Beanstalk and then apply edits to the configuration file of Elastic Beanstalk to Install Nodejs on the EC2 instance.
Or another solution is you can setup you PHP and Node application on a standalone EC2 instance and after everything is set you can create the AMI of that instance and use it in Elastic beanstalk .
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.customenv.html
Recently I have been involved in a project where I have set up a LAMP stack in AWS and also helping out the team for building other infrastructure. As per company policy, we need to create a new instance in every 60 days taking the latest ami and kill the previous one. For this reason, I requested the development team to move the php code to git repo. This would help me automate the build so that I can directly pull the code from git. But, they are saying they don't want to move the code in git for some licensing reason as the code they are using have been purchased from phpgrid (vendor). This is little strange to me...anyways, if the code is NOT in git, how can we automate the code deployment in webserver? Any thoughts on the best practices? Don't want to ftp the code from someone's machine :(
AWS Code Deploy service is purpose-built for code deployments like this.
AWS CodeDeploy is part of a family of AWS deployment services that
includes AWS Elastic Beanstalk, AWS CodePipeline, AWS CloudFormation,
and AWS OpsWorks. AWS CodeDeploy coordinates application deployments
to Amazon EC2 instances, on-premises instances, or both. (On-premises
instances are physical devices that are not Amazon EC2 instances.)
An application can contain deployable content like code, web, and
configuration files, executables, packages, scripts, and so on. AWS
CodeDeploy deploys applications from Amazon S3 buckets and GitHub
repositories.
You can use any repository really. You just need a process to move the code from its repo to an designated S3 bucket. The code can be anywhere: SVN, on-premise, etc. Just zip it up, move to S3 and register the revision and deploy as needed. A GIT repository is not required, but it is directly supported by CodeDeploy.
We integrate the process with Jenkins our Continuous Integration server so all builds are sent to S3 as a CodeDeploy-ready revision.
There is no cost for using this feature when deploying to AWS instances - its free!
Total newb question I'm sure but I'm new to S3 and trying to open a simple PHP file on my server. Yet it prompts to Save the file each time instead of opening it. Is S3 not able to run PHP files?
I believe Amazon S3 is a storage not a server.
Amazon S3:
Amazon Simple Storage Service (Amazon S3), provides developers and IT teams with secure, durable, highly-scalable object storage. Amazon S3 is easy to use, with a simple web service interface to store and retrieve any amount of data from anywhere on the web. With Amazon S3, you pay only for the storage you actually use. There is no minimum fee and no setup cost.
Link: https://aws.amazon.com/s3/
Amazon EC2:
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.
Link: https://aws.amazon.com/ec2/
You want to get an instance from EC2 and install php on its linux server.
AWS has a great tutorial to do so here.
Basically AWS EC2 linux servers are the same as any other linux server except lots of features from AWS so you can follow other tutorials on how to install PHP on an Apache2 servers.
Good luck!
EDIT: However, you can host a static website. Static website is a website that shows the same content for all users. Basic informational websites are the example. As opposed to static website, dynamic website is a website that shows different contents for different users. The purpose of php script is to create a dynamic website, so you must look for other options than AWS S3. So EC2 would be great fit for you.
So I am trying out AWS (Amazon Web Services) and I figured out how to put my db and its information on their server however I am not sure as to where I will put my php web service which gives a JSON response. Is there a tutorial or can someone tell me how I can accomplish this?
Suppose you are going to use the LAMP stack. I would either install LAMP on your EC2 instance or find a community image that has LAMP already installed and create an instance using that image.
You can start with Amazon Lightsail which is a beginner friendly service to deploy applications.
Or you can put your Application in Elastic Beanstalk and use its build in RDS feature for your database.
Attached you see the documentation for deploying a PHP application.