How to create an AWS AMI from a .out file? - amazon-web-services

I'm setting up a new infrastructure on AWS and I need to deploy loadbalanced firewalls.
I bought FortiGate licences (6.0.6) but there is no official (from Fortinet provider) AMI available for this version.
I've downloaded the .out file from the Fortinet website that contains the FortiGate firmware related to my license and now I need to create my own AMI from this .out file.
So I've tried putting the .out file in a S3 object and use this S3 to create an AMI. But I need a manifest from this S3 to create a new AMI which I apparently do not possess (I can't find it).
How can I use this .out file to create a, private, AWS AMI ?

An Amazon Machine Image (AMI) can be created from an Amazon EC2 instance:
Launch an Amazon EC2 instance using a normal AMI (eg Amazon Linux, or whatever one you want)
Install software and configure the instance as you desire
Choose Create Image to create an AMI from the Amazon EC2 instance
You might find some software relating to creating bundled images from S3, but that is for something older called Instance Store-backed AMIs. You don't want to use them these days.

Related

AWS EC2 - How to create a backup locally/file system

Is it possible to backup EC2 instance locally? (Not just the data , but the installations on Linux in EC2 as well)
I found number of options that would take data backup, but is there a way where we could backup fully functional Ec2 as is to local system? If not, can we download the image may be of EC2 locally which can be restored to same/another AWS environment when needed?
can we download the image may be of EC2 locally which can be restored to same/another AWS environment when needed?
for this the easiest solution would be this
got to instances under ec2 service in your account management console.
select the instance you wish to backup/copy.
select create image.
once image is created you can view it under ec2 navigation pane -> images-> ami.
to launch instance from the image, select and launch it.
could backup fully functional Ec2 as is to local system
the possible solution what i know and have tried to use export.Exporting as a VM is useful when you want to deploy a copy of an Amazon EC2 instance in your on-site virtualization environment. You can export most EC2 instances to Citrix Xen, Microsoft Hyper-V, or VMware vSphere.
your VM which is to be exported is stored in s3 so you will be charged according to s3 rates+ EBS snapshot charge

AWS Cloud formation does not copy the data to the newly created stack

In AWS cloud formation, i use the cloud former tool. I can use that tool to create a cloud formation template from existing resources. And then use the template to create a stack. I tested with that tool. It can work, (as in it can create instances with same memory size, with same volume size, same VPC settings, and auto start the instances). But there is no files in the volume.
Do i have to create a snapshot of the existing volume, create a new volume from the snapshot, attach it to the newly created instance, and copy the files manually ?
Or is there any better way ?
Do i have to create a snapshot of the existing volume, create a new volume from the snapshot, attach it to the newly created instance, and copy the files manually ?
Cloudformation is provisioning resources, but is not responsible for provisioning the contents of those resources - that you have to do yourself.
You can leverage the EC2 Userdata to manually pull files from S3 or other repos as the instance boots.
Or is there any better way ?
If you want to share data between applications, EFS is always an option. In your case, though, using Userdata might be effective.
If you wish to launch new EC2 instances with software automatically loaded, there are basically two choices:
Use a pre-configured AMI, or
Use a startup script to load the software
Pre-configured AMI
An Amazon Machine Image (AMI) is a copy of a disk. When a new EC2 instance is launched, an AMI is selected and the boot disk (and optionally other disks) are automatically pre-loaded with the contents of the AMI.
A common practice is to boot an EC2 instance and configure it as desired. Then, create an AMI. Thereafter, when a new EC2 instance is required for the application, launch it using the pre-built AMI.
There are also tools available to automate the building of an AMI, such as Netflix Aminator and Packer.
Benefits: New machine boots quickly, fully-configured.
Issues: Need to create a new AMI whenever you update your software.
Use a startup script to load the software
When an Amazon EC2 instance is launched from a standard Amazon-provided AMI (eg Amazon Linux, Microsoft Windows), software on the AMI automatically looks at the User Data passed to an EC2 instance. If the User Data contains a startup script, the script will be executed -- but only the first time that an instance is launched. This is an excellent way to install software on the instance.
You are responsible for writing the script. The script should install whatever tools, software and data you want on the instance.
Benefits: Updating your software? Just launch a new instance and the script will install the latest version of your software (assuming you have written the script to always point to the latest version).
Issues: It takes longer to launch the new instance, since the software is being installed.

How to copy Windows EC2 instances to S3 bucket in AWS?

I am not able to find a find documents showing how can I copy a Windows instance to an Amazon S3 bucket.
Can any one help me with step by step approach to do this and suggest some of the links?
You can not copy AMIs to s3. You can either create a snapshot of your volumes or create another image (AMI).
I assume you're trying to create a backup of your AMIs. So, there are some alternatives for doing that.
Create a new AMI from an existing running image. Reference: Creating an Amazon EBS-Backed Windows AMI
Creating a Windows AMI from a Running Instance
You can create an AMI using the AWS Management Console or the command line. The following diagram summarizes the process for creating an Amazon EBS-backed AMI from a running EC2 instance. Start with an existing AMI, launch an instance, customize it, create a new AMI from it, and finally launch an instance of your new AMI. The steps in the following diagram match the steps in the procedure below. If you already have a running Amazon EBS-backed instance, you can go directly to step 4.
You can create images using the AWS CLI command create-image
Create Snapshots of your volumes, these snapshots will be stored behind the scenes in s3. Reference: Creating an Amazon EBS Snapshot
You can create EBS snapshots using the AWS CLI command create-snapshot
+ Resources
Copying an Amazon EBS Snapshot
Copying an AMI

Is it possible to dowload a Windows AMI created in EC2 for a local copy

I am making a backup of all the instances in EC2 and I am following the best practices specified by techsoup for backup
In this it is mentioned to keep a local copy of the server at 2 different locations. I was wondering if it is possible to download a Windows AMI created in Amazon EC2 which was not exported from the local VM or using the AWS CLI. It is completely an EC2 instance whose AMI was created for backup.
Can I keep a local copy of the AMI for on-premise backup?
No, it is not possible. If the AMI needs to be kept in two locations then those locations should be separate AWS regions. You can copy the AMI to another region using the AWS CLI's copy-image or via the AWS console.

Autoscaling ec2 instance without loss of old data

Recently My Website shifted on Amazon.
I create EC2 Instance. Install lamp and Setup CodeIgnitor in /var/www/http folder.
the structure
Codeignitor folder I have folder name 'UPLOAD'.this folder is used for uploaded images and files.
I make AMI image from EC2 Instance.
I have setup Auto scaling of Ec2 instances.
When my old ec2 instance is failed then automatically new instance is created. But My all data from "UPLOAD" of folder on old ec2 instance has lost.
I want to separate "UPLOAD" folder in codeignitor from ec2 instance.
So whenever new instance is create it will get UPLOAD folder and its contents without loss.
I want to separate this upload folder. so when new instance is create then it will get this data.
how to do this.
Thanks for Advance.
Note . I have used MYSQL on Amazon RDS.
You can use a shared Elastic Block Storage mounted directory.
If you manually configure your stack using the AWS Console, go to the EC2 Service in the console, then go to Elastic Block Storage -> Volumes -> Create Volume. And in your launch configuration you can bind to this storage device.
If you are using the command line tool as-create-launch-config to create your launch config, you need the argument
--block-device-mapping "key1=value1,key2=value2..."
If you are using Cloudformation to provision your stack, refer to this template for guidance.
This assumes Codeignitor can be configured to state where its UPLOAD directory is.
As said by Mike, you can use EBS, but you can also use Amazon Simple Storage Service (S3) to store your images.
This way, whenever an instance starts, it can access all the previously uploaded images from S3. Of course, this means that you must change your code for the upload, to use the AWS API and not the filesystem to store your images to S3.