{"id":2733,"date":"2018-02-09T17:09:38","date_gmt":"2018-02-09T17:09:38","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2733"},"modified":"2018-06-13T18:24:19","modified_gmt":"2018-06-13T18:24:19","slug":"aws-your-own-machine-image","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/02\/09\/aws-your-own-machine-image\/","title":{"rendered":"AWS &#8211; Your own machine image"},"content":{"rendered":"<p>Until you start to actually use Amazon storage (elastic block store) you end up repeating yourself a lot getting your machine images into a working state.\u00a0 This\u00a0 might be something really simple such as adding your world class html code to your web site, or it might be adding other tools to your environment, it could even be the setup of your web server.<\/p>\n<p>In anycase, the act of repeating the same actions time and time again does begin to it lose it charm after about 3 or 4 times.\u00a0 It is possible to actually save the state of your machine images by creating your own custom image.\u00a0 I don&#8217;t have an entire data\u00a0 center full of machines so I will start with a single image &#8211; the web server.<\/p>\n<p>In my opinion, this turns out that this is actually easier than a lot of other steps that i have had to perform.\u00a0 The steps are pretty easy.<\/p>\n<ul>\n<li>Pick an existing AMI as base<\/li>\n<li>Start your image<\/li>\n<li>Connect to your virtual machine and modify<\/li>\n<li>Save image with new name<\/li>\n<\/ul>\n<h2>Pick an existing Amazon machine image<\/h2>\n<p>A lot of the steps for creating an Amazon machine image, AMI, is actually the same as when you first pick out an image when creating an EC2 instance.<\/p>\n<div id=\"attachment_2702\" style=\"width: 1248px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2702\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-2702 size-full\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ec2-launch-select-ami.png\" alt=\"\" width=\"1238\" height=\"742\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ec2-launch-select-ami.png 1238w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ec2-launch-select-ami-300x180.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ec2-launch-select-ami-768x460.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ec2-launch-select-ami-1024x614.png 1024w\" sizes=\"(max-width: 1238px) 100vw, 1238px\" \/><p id=\"caption-attachment-2702\" class=\"wp-caption-text\">Select an Amazon Machine Image<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_2704\" style=\"width: 1275px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2704\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-2704 size-full\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ec2-launch-select-ami.png\" alt=\"\" width=\"1265\" height=\"513\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ec2-launch-select-ami.png 1265w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ec2-launch-select-ami-300x122.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ec2-launch-select-ami-768x311.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ec2-launch-select-ami-1024x415.png 1024w\" sizes=\"(max-width: 1265px) 100vw, 1265px\" \/><p id=\"caption-attachment-2704\" class=\"wp-caption-text\">Choose which instance type of that image you wish<\/p><\/div>\n<p>It depends on either which linux flavor you desire (or which windows version you require).<\/p>\n<p>&nbsp;<\/p>\n<h2>Start your image<\/h2>\n<p>This is exactly the same steps that you had to perform to start an EC2 image. This has been described in my article &#8220;AWS &#8211; Setting up EC2&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<h2>Connect to your virtual machine and modify<\/h2>\n<p>Connecting to your machine is actually made quite painless by Amazon.\u00a0 Simply select your machine and press the &#8220;connect&#8221; button on your dashboard.\u00a0 This will bring up a big friendly dialog on how to connect to your machine.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2739\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ami-creation.png\" alt=\"\" width=\"706\" height=\"651\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ami-creation.png 706w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-ami-creation-300x277.png 300w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/p>\n<p>Not only that, it is possible to copy and paste the command from the dialog to your shell.<\/p>\n<p>If you are a windows user or are using some other operating system how to do your connection may vary.\u00a0 Amazon does have <a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/putty.html?icmpid=docs_ec2_console\" target=\"_blank\" rel=\"noopener\">instructions <\/a>for windows users.<\/p>\n<p>Once you are connected to the instance you can do any of the normal command line operations.\u00a0 One such example is the stress command.\u00a0\u00a0The stress command comes in handy when testing autoscaling.<\/p>\n<p>I have been using the Amazon Linux image which uses yum for installing software.<\/p>\n<pre>sudo yum install stress<\/pre>\n<p>Once the <a href=\"https:\/\/www.cyberciti.biz\/faq\/stress-test-linux-unix-server-with-stress-ng\/\" target=\"_blank\" rel=\"noopener\">stress utility is installed<\/a> or even Apache web server then you are ready for creating your own image.\u00a0 I didn&#8217;t install the entire LAMP for this test but Amazon does describe how to <a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/install-LAMP.html\" target=\"_blank\" rel=\"noopener\">install the entire stack<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<h2>Save image with new name<\/h2>\n<p>Once you have an instance up and running that contains all of your personal changes the rest is trivial.\u00a0 From the dashboard simply select Image from the &#8220;Actions&#8221; button and select create image (Actions -&gt; Image -&gt; Create image).<\/p>\n<p>This will bring up a dialog box asking for both the image name and a description of the image.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2740\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ami-creation.png\" alt=\"\" width=\"1063\" height=\"547\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ami-creation.png 1063w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ami-creation-300x154.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ami-creation-768x395.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-ami-creation-1024x527.png 1024w\" sizes=\"(max-width: 1063px) 100vw, 1063px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2741\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-ami-creation.png\" alt=\"\" width=\"1005\" height=\"305\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-ami-creation.png 1005w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-ami-creation-300x91.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-ami-creation-768x233.png 768w\" sizes=\"(max-width: 1005px) 100vw, 1005px\" \/><\/p>\n<p>Once you have filled this out press the create image button and after a few minutes the image will be saved under your list of Amazon images.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Until you start to actually use Amazon storage (elastic block store) you end up repeating yourself a lot getting your machine images into a working state.\u00a0 This\u00a0 might be something really simple such as adding your world class html code &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/02\/09\/aws-your-own-machine-image\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[95,90,85],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2733"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2733"}],"version-history":[{"count":5,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2733\/revisions"}],"predecessor-version":[{"id":2894,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2733\/revisions\/2894"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}