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.
Related
I want to start deploying my laravel app to production. To avoid changing AWS config in the near future, I decided to try to add continuous integration. To do this I'm using elastic beanstalk and pushing the code there using another AWS tool. All this is working perfectly. I put a test message in /public/index.php to output "hello world" and it works as expected when going to the URL. When I remove this text and run my laravel app as normal, I get a 500 internal server error. I'm not sure all what elastic beanstalk does on deployment for laravel apps. Because of this I'm not sure if this error is occurring from a bad DB connection or laravel app not fully setup yet.
I created an RDS DB instance outside of elastic beanstalk. I am able to access this from sequel pro and I added the database I will use to store all my data. I added all the necessary db connection values (host, port, database, username, password) to /config/database.php and the elastic beanstalk server configuration environment variables.
I've searched online for days for info but haven't found anything specific to this. Also part of my issue is a lack of understanding of how laravel is setup during a deployment in beanstalk. Is there something with /.ebextensions that will help me accomplish these goals?
When I deploy my code I need to make sure all vendor files are installed through composer and then I also need to make sure all database migrations/changes happen. I want to automate as many steps as possible so I can just push up code changes and server will change code and keep working.
I also want to make sure there isn't anything I'm missing for setting up my db connection. Are there any other files in laravel I need to setup or something in elastic beanstalk I need to have configured? I'm keeping my db open to all connections and then I can tighten restrictions later
EDIT: My database may not be configured correctly yet, but that appers to not be source of the issue. I think my issue is knowing what scripts and how to run them during deployment. I want to make sure composer and php artisan migrate is ran to keep everything up to date. How can I do this with elastic beanstalk?
This is a little off topic but with my experience I do not recommend using beanstalk to achieve a good workflow pushing and deploying. I recommend
you to use Forgelaravel.com to deploy your GitHub repository. In forge Laravel you will be able to create a server from AWS and it will automatically create database connections and stuffs, then with just one click you can deploy to the server and keep a good workflow.
Given that we're speaking of a Laravel application, this 500 Server Error
often occurs when one is creating new infrastructure. Why? It's likely to forget to add the environment variables to the EB environment.
Simply go to that EB environment configuration, then under software modify to include at least the following environment properties
APP_DEBUG (can be, for example, false)
APP_KEY (this is the key generated with php artisan key:generate)
APP_NAME (tiagoPeres)
Then the issue will be gone.
I created multiple REST api's for my website on a local server(wamp) and now i am trying to move it to a online server(aws elastic beanstalk). My question is where do i build my database with the tables and rows etc just like in phpmyadmin? I figured that "upload and deploy" means upload the php file i made but when i do i get an error saying "health degraded". So what i want to do is basically move my local server to an online one with aws EB. I watched a bunch of videos and did a lot of research but can't seem to find the way to go about this problem.
My question is where do i build my database with the tables and rows
etc just like in phpmyadmin?
You can connect to the RDS instance created by beanstalk using a Database Management Client Tool like MySQL Workbench, Heidi SQL & etc using the DNS name, created for RDS instance. However one challenge you will face is to access the RDS instance from your client machine, since its not a good practice to make the Database publicly accessible. You can create a EC2 instance (Windows or Linux with GUI) inside the same VPC, connect to it (Remote Desktop or SSH) and install the tools so that you can use the tools inside the server, to connect to the RDS instance.
I figured that "upload and deploy" means upload the php file i made
but when i do i get an error saying "health degraded"
To understand the structure in code inside the Zip file, I would recommend to create a Beanstalk environment with a sample project available in Beanstalk and download the sample project artifact (Zip file) from S3 so that you can compare the project structure requirements.
If you prefer to go through the documentation, you can refer this. If nothing goes well, connect to the ElasticBeanstalk provisioned EC2 instance (Either using Remote Desktop for Windows or SSH to linux) and investigate the deployed artifacts.
I am new to laravel and AWS. I have created a website in laravel and deployed it in ec2-instance. I want to make some bug fixes in the files. How can I make those changes on the existing EC2 instance??
Rather than SSH into your instance, do you have something like WinSCP which is an FTP app I use for my AWS instances. If not, install WinSCP (or equivalent), add your ppk file for authentication, and you should be good to go.
Also - just ensure you have the correct folder permissions in your code folder. If not - you'll need to SSH in and fix that, as you'll get a permissions error when you try to upload your new files.
You should be able to SSH into the EC2 instance.
Here's a link on how to SSH into an EC2 instance:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
I am very new to AWS. I am trying to deploy my php application to AWS. I created an environment and then uploaded and deployed all files (including .sql) in zip format. When I am trying to access my website using URL it doesn't show anything. When I tried viewing page source, it showed database connectivity error?
Any help would be appreciated.
Thank you.
For Database connection,
You need create a new environment either using RDS or on the instance.
You can set up RDS using Beanstalk.
Refer :http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.rds.html#create_deploy_PHP.rds.newDB
Still you will have much to manually configure to load your existing data to RDS or to the instance.
Hope it Helps.. :)
I had written a blog on a similar use case. I also have a screencast on the same. Can you follow this and see if this helps:
http://www.tothenew.com/blog/aws-elastic-beanstalk-php/
I have deployed a wordpress PHP website. Look what you need is a new RDS or an old RDS instance or Database on an EC2 server and have to give PHP app that endpoint and port.
Im using AWS ec2-instance to run my website with a public ip of xxx.xxx.xxx.xx
All php files were stored on this instance. Now for some reason I dont know how, the public ip changed to aaa.xxx.aaa.xx and all the files disappeared and everything got deleted. I never started/stopped the ec2 instance because this changes the public ip. This happened so randomly. Now I dont have recent updates of my php files so I need to rewrite them. I would assume amazon would send me an email saying that they would change our public ip.
An auto-scaling group will launch instances as required to meet the number of instances expected. This can occur when scaling up or when an existing instance becomes unresponsive.
Newly launched instances will be created using the configured image. So if your configuration changes or app source code aren't part of the image they won't be present in the new instance.
If the contents of your instance doesn't change often, you can simple create a new image from an instance running your app and configure the auto-scaling group to use it as the image for new;y launched instances.
Another approach, using Elastic Beanstalk, is to create an application version, either as a bundle or using the EB CLI command eb deploy. The Elastic Beanstalk app can also include instructions on how to configure your instances. The app and its environment configuration will then be applied to any instance launched by Elastic Beanstalk.