Issue to deploy a wordpress website through ElasticBeanstalk - amazon-web-services

I follow this and this to create a wordpress website through AWS ElasticBeanstalk.
What I did:
Create a wordpress site in localhost
Create an app in ElasticBeanstalk with RDS
Export database locally and import to RDS
Initialize git in wordpress folder locally
Download the ElasticBeanstalk Command line tool and add it to wordpress folder
Run git aws.config
Run git aws.push
It works well until the step 7. I got the following error message:
Updating the AWS Elastic Beanstalk environment
mywordpress-env... Error: Failed to get the Amazon S3 bucket
name
Can anybody explain what this mean? And how to solve the problem? Thanks.

I had such problem today, when My Ubuntu laptop didn't change the time automatically, so there was one-hour time difference in comparison to real time:).
I hope you solved the problem before my answer :)

Related

Deploy app to AWS Elastic Beanstalk using docker-compose

I'm trying to deploy a multi-container app to AWS Elastic Beanstalk using docker-compose. My folder structure is as follows:
AppDirectory/
app/
proxy/
scripts/
static/
docker-compose.yml
Dockerfile
requirements.txt
I've got the images built and pushed into Docker Hub. Also, the environment is working as expected when running docker-compose up in development. Using AWS Elastic Beanstalk dashboard, I create an application and then I proceed to create an environment, using Docker as platform. I have a .zip folder with the structure mentioned before.
When creating the environment, there's first a console log telling me that Configuration files cannot be extracted from the application version appname-source. Check that the application version is a valid zip or war file.
Not sure what it means here, as I'm uploading a .zip file and inside there are Dockerfile and docker-compose.yml.
After it says the app deployed successfully, I get a 502 Bad Gateway error from nginx and then I have the environment with severe health and updating for hours without changes. I've been following the documentation regarding this and I believe it is possible to deploy it with docker-compose.yml, however I'm wondering if my configuration is enough? I linked the Docker Hub images also inside my docker-compose. I'm not able to request logs neither as the state must be 'ready', and it is constantly 'updating'.
Anyone with any experience with such deployment that wants to share any tips or configuration settings? Thank you.

Cannot deploy my monorepo API folder to aws Elastic Beanstalk

I am trying to set up a monorepo with a react frontend in a client folder, and an express backend in an api folder.
I have successfully deployed the frontend to aws amplify, but I cannot deploy my backend using aws elastic beanstalk and aws codepipeline.
I am getting the following error message in aws Elastic Beanstalk: "Instance deployment failed to generate a 'Procfile' for Node.js. Provide one of these files: 'package.json', 'server.js', or 'app.js'. The deployment failed."
I know the error message is obvious, but I cannot find anywhere that specifies what I should set in my procfile, package.json or so on, in my root folder so that Elastic Beanstalk can target my api folder. More specifically the path "/api/server.js"
I have looked high and low for a solution but nothing seems to work...
Has anyone had this issue before and could perhaps help? I've been trying to solve this for 9 days now... :'(
Really appreciate any help on this!

AWS How to deploy my internet site created with Typescript on AWS

I have create a website using VS Code in NodeJS with typescript language.
Now I want to try to deploy it on AWS. I read so many things about EC2 , Cloud9 , Elastic Beanstalk, etc...
So I'm totally lost about what to use to deploy my website.
Honestly I'm a programmer, not a site manager or sysops.
Right Now I create an EC2 instances. One with a Key name and One with no key Name.
In the Elastic Beanstalk, I have a button Upload and Deploy.
Can someone send me the way to create my project as a valid package to upload and deploy it ?
I never deploy a website. (Normally it was the sysops at the job). So I don't know what to do to have a correct distributing package.
Does I need to create both EC2 and Beanstalk ?
Thanks
If you go with ElasticBeanstalk, it will take care of creating the EC2 instances for your.
It actually takes care of creating EC2 instance, DB, loadbalancers, CloudWatch trails and many more. This is pretty much what it does, bundles multiple AWS services and offers on panel of administration.
To get started with EB you should install the eb cli.
Then you should:
go to your directory and run eb init application-name. You'll start a wizard from eb cli asking you in which region you want to deploy, what kind of db and so on
after that your need to run eb create envname to create a new env for your newly create application.
at this point you should head to the EB aws panel and configure the start command for your app, it usually is something like this npm run prod
because you're using TS there are a few steps you need to do before being able to deploy. You should run npm run build, or whatever command you have for transpiling from TS to JS. You'll be deploying compiled scripts and not your source code.
now you are ready to deploy, you can run eb deploy, as this is your only env it should work, when you have multiple envs you can do eb deploy envname. For getting a list of all envs you can run eb list
There are quite a few steps to take care before deploying and any of them can cause multiple issues.
If your website contains only static pages you can use Amazon S3 to deploy your website.
You can put your build files in S3 bucket directly and enable static web hosting.
This will allow anyone to access your website from a url globally, for this you have to make your bucket public also.
Instead you can also use cloudfront here to keep your bucket private but allowing access to bucket through cloudfront url.
You can refer to below links for hosting website through s3.
https://docs.aws.amazon.com/AmazonS3/latest/user-guide/static-website-hosting.html
https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/

how to restart Django server without terminating database and server instance - AWS

I am hosting a Django application on AWS Elastic Beanstalk. I recently made changes to my URLS.py and apparently (according to this thread: Django ignoring changes made to URLS.py file - Amazon AWS ) I need to 'reload the django process / restart the thread'. I figured that meant for me to run
eb stop
and then
eb start
again but when I ran
eb stop
it needed to first terminate my database as well as my EC2 instance, cloudwatch alarm etc. Is there any way for me to restart the DJango process so that it can update the URLS.py file without me having to run
eb stop
eb start
?
You do not need to stop and start your environment. From what I understand you need to update your environment with your updated source code. Did you try git commit folloed by git aws.push?
Take a look here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-reference-get-started.html
Let me know if you run into any issues with git aws.push.
You can also try restart app server on your environment using aws cli:
http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/restart-app-server.html
But as far as I can tell, git aws.push will suffice.
I've had troubles with my Django files not updating after using:
$ eb deploy
The eb cli tool does not have a restart command, however you can login to the AWS console and restart your environment through the actions menu on the dashboard for your eb environment.
This generally fixes any issues that I have. However sometimes I've had to ssh directly into the instance and enable debugging through the settings.
The other command that Rohit referenced is from a different aws cli tool. I haven't personally tried it but here is more documentation on the command and how to install it:
http://docs.aws.amazon.com/cli/latest/userguide/installing.html

Deploying failed in AWS Elasticbeanstalk

I have a problem in deploying PHP based web application in AWS EB. I tried to push files using GIT bash; it went fine and shows completed 100%.
Then I checked in my AWS console it shows "Environment update is starting." after few seconds it shows
"Service:AmazonCloudFormation, Message:Stack:arn:aws:cloudformation:us-east-1:556003586595:stack/awseb-e-m3tbtwpcpe-stack/0bb57070-5fac-11e2-af2e-5081b23f0c86 is in UPDATE_ROLLBACK_FAILED state and can not be updated."
"Failed to deploy application."
Please help someone how to resolve this issue. I am in urgency of setting the web application in AWS EB as soon as possible.
Thanks in advance,
Sankar.
Have you tried rebuilding the environment from the AWS Console? Are you doing anything less common like running your Beanstalk environment inside of a VPC?