In this tutorial, you will learn how to modify your existing AWS Elastic Beanstalk application and then terminate that application. This tutorial is a continuation from the Launch an Application with AWS Elastic Beanstalk tutorial, so please go through that tutorial first if you haven’t already. This tutorial will cover how to update your existing application and then how to get rid of your Elastic Beanstalk environment, which includes your application.
a. Navigate to the directory where you downloaded the php_v1.zip file in the previous tutorial.
Windows Users: To unzip the php-v1.zip file, right click on the php-v1.zip file, click Extract All..., then click Extract.
Mac Users: Double click on the php-v1.zip file, and this will automatically unzip the file into a php-v1 folder in the same directory.
b. Navigate into the newly unzipped php-v1 directory. Open index.php using your favorite text editor. You will make a small edit here that is an example of an application change. Look on line 26 for <h1>Congratulations!</h1>. Replace Congratulations!, with Application Updated! in between the <h1> and </h1> tags. Then save the index.php file (overwriting the original).
Next you will need to zip your application so it can be uploaded to AWS as an update package.
Windows users: Please select Windows below to see how to create the zipped application file.
Mac & Linux users: Please select Mac/Linux below to see how to create the zipped application file.
a. Click here to open the Elastic Beanstalk console. Within the Elastic Beanstalk dashboard, click on php-sample-app at the top of your screen, and this should show a drop-down menu where you should select Application Versions.
b. Here you should see one entry in the Version Label column titled First Release. The Source column for this entry should show the php-v1.zip file we uploaded in the previous tutorial. Click on Upload, enter Second Release for Version label, then Sample PHP App Update for Description. Click Browse, then navigate to the location where your php-v2.zip file is located, Select the php-v2.zip file and click Upload.
c. You should now see Second Release within the application versions table. Check the box for Second Release, then click Deploy. You should see your Environment defaulted to phpSampleApp-env. Leave the default settings here and click Deploy. Lastly, click Elastic Beanstalk in the top left hand corner of the web page.
d. Click on the green box titled phpSampleApp-env to see the view of your application's environment.
e. Here, you can see a Recent Events section that displays your application being updated.
a. Once you see Environment update completed successfully within Recent Events, click on your application URL toward the center top of the screen to view your updated application.
b. You will see that instead of the Congratulations! text that existed in version 1 of your application the text has been updated to version 2 with the heading Application Updated!
Congratulations! You have successfully updated your AWS Elastic Beanstalk application.
a. To delete your application (and stop using the AWS resources associated with your application), access your Elastic Beanstalk application dashboard, click on Actions in the top right-hand corner, then select Terminate Environment.
b. You will be presented with a warning/confirmation screen. Click Terminate to continue.
Note: It may take a couple of minutes for the environment to completely shut down.
Now that you have an Elastic Beanstalk application up and running, the next tutorial will walk you through registering a domain name so your website/application can be easy to access.