How to make server image for load balancing? - amazon-ec2

I have an amazon server with I'm told 2-5 instances to handle traffic. I was told that whenever I upload the latest code to the main server I have to make an "image" of it so that the other servers can copy that image when there is more traffic and they are activated. How do I make the image? On command line? Or not. I'm uploading code through SSH. I don't know much about this.

The easiest way for a novice to do this is in the AWS Management Console. You can right click on your instance and select "Create an Image (EBS AMI)". Note that your image must be backed by EBS.
Hope this helps.

Related

Azure DevTestLabs custom Image error "Creating a virtual machine from Marketplace image requires Plan information in the request"

In Azure DevTestlabs I have made a custom image from a market resource (CIS hardened image) and saved it to blob storage. After this I want to create a VM from this image (and do other things with the image).
I have this process automated through Azure Pipeline which was working until three months ago. A few days ago I gave it another spin and it fails on creating the VMs.
Since the custom image was created, instead of going through my scripting I decided to create a VM from the portal.
Now when I try to create a VM from the image in the portal I get the following error:
Creating a virtual machine from Marketplace image requires Plan information in the request
Did anyone run into this or have any ideas where to look for a solution?
Thanks in advance
The plan resource does not exist for Microsoft.DevTestLab labs/virtualmachines template
https://learn.microsoft.com/en-us/azure/templates/microsoft.devtestlab/2018-09-15/labs/virtualmachines
Try re-creating the custom image and try again.

How to save/backup amazon instance local

I would like to lower the cost paying to Amazon.
There are stopped instances that I want to backup and save on my local server, on-prem.
After creating an image from the instance, is there any way I can copy AMI to my local server and remove it from Amazon. So in a day, I will need back, it can transfer back from my local server to Amazon to use it again?
The instance first created on Amazon.I rather a way to save instance on-premise as a file and not as a virtual server.
The main issue is: How can I transfer and save the image of an instance, that created on Amazon, as a file to the local server and how I can return it back to be in Amazon, in case I need to build the instance again.
Is there any way to do it?
Thanks a lot!
You can use some backup software (duplicati, cloudberry, or anything else):
Install backup software to your EC2
Make an image backup to S3 cloud storage
Install backup software to your physical machine
Restore image from S3 cloud storage to physical machine or your local storage to keep this backup locally.
And the last, but not least thing:
Good luck!)))
You would need to use the VM Import/Export Tool for that. Read the docs to make sure you know how to upload again.
As to the cost, I am not sure how Amazon configures the cost, that is something you have to check out from your account. Once you create the image it is on your account. Even after you download it, not sure when AWS charges you or not.
You can create an image file from your current drive but it will be quite expensive:
create another instance
attach your volume there as the second drive
use something like dd if=/dev/xvd0 of=drive.img ... to copy volume to a file
rsync / ftp / etc the file to your local drive.
You will be billed for the second instance and for the transfer. When you want to restore the machine - you'll be billed too.
Have you checked free tier? You have a year of free access to AWS for small instances and volumes.
You need a tool to get what you want. Take eg Cloudberry and create an image and store it at Amazon and then restore and things are done. This is the best option for you. No other ways.

How can i upload image files to aws ec2 instance?

My web application server on AWS ec2 instance.
And using MEAN stack.
I'd like to upload image to ec2 instance.(ex - /usr/local/web/images)
I can't found that how can i get the credentials.
There are just about AWS S3.
How can i upload image file to ec2 instance?
If you do file transfer repeatedly try, unison. It is bidirectional, kind of sync. Allows options to handle conflicts.
I've found the easiest way to do this as a one-off is to upload the file to google drive, and then download the file from there. View this thread to see how simply this can be done!

AWS autoscale and server code updates / editing

Say I've got a PHP site on an ec2 instance in an autoscale group. The group has 10 running instances. I want to add some new php code to the site. Is there a sane way to do this and have it populate to all other instances in the autoscaling group?
The only way I can see is to manually bundle an image from the instance, upload it to S3, register the bundle with aws and attach the bundle to the launch config of the autoscale group. I then have to terminate all my instances and launch new ones with the new image.
I would have to do all this every time I want to make a change to the codebase. Surely this is madness.
The best way is NOT to bundle your page into the image. Make the ami download them from s3 on start. In this way you can upload to only one place and call the download script.

Blobstore Images Disappearing on Google App Engine Development Server

I'm using App Engine's high performance image serving on my site, and I'm able to get everything working properly on both my local machine and in production i.e. I can upload an image and successfully display the images using get_serving_url on the blob key. However, these images don't seem to persist on my development server, i.e. after I come back from a computer restart, the images no longer show up. The development server spits out:
images_service_pb.ImagesServiceError.BAD_IMAGE_DATA
which I'm guessing is actually because the underlying blobs are no longer there (although this is just a hunch). The rest of my datastore is still intact though, as I'm using the launch setting "--datastore_path" to ensure my data persists. Is there a separate flag I need to be using to persist the blobs as well? Or is there a separate problem here that I'm missing?
You must use --blobstore_path=DIR:
--blobstore_path=DIR Path to directory to use for storing Blobstore
file stub data.
You can see all options typing dev_appserver.py --help in the command line.

Resources