creating EBS volumn from and attaching to the same instance? - amazon-ec2

Is it possible to create a EBS volume from and attach it to the same instance?
will boto be of some help?

Yes, you will need to install the ec2-api tools http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=88
then use ec2-create-volume and ec2-attach-volume commands: http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/
I haven't used boto for this and don't know if it can, but I have found boto to always make things easier if it can be used.

You can even do this from the EC2 console:
- create a snapshot of your volume
- create a new volume of that snapshot
- attach the new volume to your instance
all actions are supported by the console

Related

Cannot get Fabric8 to fully launch in AWS using stackpoint

I have been trying to spin up a Kubernetes/Fabric8 installation on AWS using Stackpoint as described in this video: https://www.youtube.com/watch?v=lNRpGJTSMKA
My problem is that three of the apps wont start becuase no volumes are available and I cannot see how to resolve those PV requests. For example Gogs is reporting the following error:
Unable to mount volumes for pod "gogs-2568819805-bcw8e_default(03d618b9-7477-11e6-8c6b-0a945216fb91)": timeout expired waiting for volumes to attach/mount for pod "gogs-2568819805-bcw8e"/"default". list of unattached/unmounted volumes=[gogs-data]
Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "gogs-2568819805-bcw8e"/"default". list of unattached/unmounted volumes=[gogs-data]
I am pretty sure this is very simple but cannot see how to connect the dots here from the various K8, Fabric8 docs. I can create a new EBS volume in AWS easily enough but cannot see how to then update this running stack to attach it to these services. Any help would be greatly appreciated!
Sorry about that, what version of gofabric8 are you using? We're currently adding persistent volume support for the core platform apps although the integration our stackpoint isn't there quite yet. Hopefully soon though.
For now you should be able to disable the PV claims using --pv=false during the deploy. So gofabric8 deploy --pv=false. We'll look at using this as the default until the integration is there and we can leverage AWS persistent volumes
We just shipped functionality that allows you to create and manage AWS volumes for Kubernetes. You get a volume, PV, and claim - just name the claim to be what is required by Fabric8. Eventually, you'll be able to use dynamic volume creation.

Installing DSE on Amazon EC2 m4.* instances

I would like to install DSE on m4.* instances, but it seems that the latest ComboAMI doesn't support it. Since it requires a different configuration, as it's not an instance-store backed instance, but rather an ebs-store backed instance and also a HVM instance and not PV instance.
I've started working on a new provisioning script, that basically does what the ComboAMI provisioning script does, but also adds the RAID0 creation for the EBS volumes that I attach per node, and the xfs file system creation.
My question is divided to two parts:
First of all, I was wondering if anyone in DataStax has already done something similar that he can share, since that can be a great reference for anyone that wants to do something similar.
Second of all, has anyone had any experience building a similar AMI on a m4.* instance type? I didn't manage to get something to work with the ComboAMI project.

Modify datastax cassandra ami startup script

I am exploring the possibility of modifying https://github.com/riptano/ComboAMI to support Ec2MultiRegionSnitch.
In that:
Add option --snitch Ec2MultiRegionSnitch -> modify cassandra.yaml to write snitch as multi region
Add option --broadcast_address_as_public_ip yes -> modify cassandra.yaml to write broadcast_address: public_ip
Add option --seeds 100.222.111.222, so as the newly created instances can join an existing cassandra, e.g. 100.222.111.222.
Tested the settings and worked.
The restrictions
I can't copy the datastax ami to be my own ami.
I can't snapshot an existing datastax cassandra instance into an AMI, such that I modify the script locally to get it launched.
The question:
How to modify the script and test it out.
Should I use AutoScalingGroup with a Launchconfiguration to point to this AMI, then use sed to modify the cassandra.yaml, service restart cassandra instead? It is not obvious to me how to run a script after the AWS launch configuration has completed launching the instance, especially I can't get the AWS::Instances::GetAtt PublicIP for the broadcast address. Ideally speaking the changes should have been done during cassandra.yaml construction in the script, not after.
Thanks!
That's correct, the AMI has to be rebuilt on a clean image under your account. We have instructions here on how to do so:
https://github.com/riptano/ComboAMI/blob/2.5/presetup/setup.md
As far as the the AutoScalingGroup question, I'm not sure how beneficial that would be. If you create your own image, off your own repo, feel free to create a pull request and I'll look them over to merge them into the official AMI.

Mount amazon instance store to another instance - it is possible? how?

Due to system crash after update i set up new instance with ebs(old instance has an instance store). But i need to copy some data form old instance to new. It`s possible to mount instance store from old instance to new? How to do this?
Have you come across this thread: Mounting Old EBS Volume to the new Instance - Amazon EC2
I'm not sure if that's what you're looking for, but the answer on that thread details the process of mounting the old EBS volume to the new one on an Amazon EC2 instance.

Can I make an AMI from a running instance that uses instance-store as its root device?

Or is it absolutely necessary to have an EBS backed storage? Does anyone have manuals/Howtos?
I am following the manual given on this site.
You can create an AMI from either an EBS or S3-backed running instance. The simplest way is to use the AWS Management Console to select the instance and click 'Create Image' from the Instance Actions menu.
This will create either an EBS or S3-backed AMI, depending on the type of instance.
Be aware that creating an AMI from a Running instance is inherently potentially unsafe - the storage is not imaged as a hard 'point-in-time' snapshot, so changes to the filesystem whilst the image is being created may not be recorded, and may even result in a compromised image. You should quiesce the OS as far as possible before starting.
Note also that your instance will reboot during the image-creation process, so make sure you're prepared for any temporary loss of service from the VM.
If you bundle a Windows EBS instance while it is running, its Administrator password will be reset by Amazon's rebundling tools - so you'll have to use the EC2 "get Admin password" function with instances launched from the new AMI.
If you stop your Windows instance before rebundling, its Administrator password will remain intact through the rebundling process.
I don't know if this is documented anywhere, but it's certainly been my experience with Windows 2003 instances.
you will to refer the manual for the three commands:
ec2-bundle-vol, ec2-upload-bundle, ec2-register.
Keep at hand your private and certificate key (eg. pk.pem, cert.pem files) and your access and shared key. Download the ec2 ami tools and setup the environment variables for the ec2 ami tools. This site might give you the details on how to bundle the volume, create the images, upload them to S3 and finally register it as your own ami.
http://alestic.com/2009/06/ec2-ami-bundle
It is possible to create an AMI from an EBS running instance using the AWS management console. as mentioned by Eight-Bit Guru by clicking 'Create Image' from the Instance Actions menu.
For the S3 backed instance it is currently not possible without bundling the instance.
If you are using a linux ami then you have two ways as explained in this guide:
Creating an AMI from S3 backed instance - For Linux
For windows based S3 backed instance you can follow other guide
Creating an AMI from S3 backed instance - For Windows
Hope this will help for creating an AMI for S3 backed intances.

Resources