Is it possible to attach usb to an instance? - google-cloud-platform

Is it possible to attach usb to an instance? Just curious to know if it is possible to attach memory stick or external hard disk on GCP instance

It's not possible to attach USB (or any other storage device that you own) to a GCP VM instance.
Only supported storage solutions are described in the official documentation.
It's possible to attach a local SSD disk but it's just a temporary storage - in case of VM restart (or shutdown) data are lost (in most cases).
You could mount your own USB stick as a samba share but you'd have to run another machine somewhere where you can physically connect it and share it from.

Related

Is volume in aws like a hard drive that the instance uses?

I am learning about aws and using ec2 instances. I am trying to understand what a volume is.
I have read from the aws site that:
An Amazon EBS volume is a durable, block-level storage device that you
can attach to your instances. After you attach a volume to an
instance, you can use it as you would use a physical hard drive.
Is it where things are stored when I install things like npm and node? Does it function like the harddrive o my server?
AWS EBS is block storage volume, and for the ease of understanding, yes you can consider it same as hard drive, however with more benefits over traditional hard drive. few of them are:
You can increase/decrease size of the storage as per your requirement
(Hence name Elastic)
You can add multiple ebs to your instances, for example 20 GB of volume1 and 30 GB of volume2
And for the question you asked if you can install npm & node yes you
can as it would be attached to your EC2 instance and your instance
can easily utilised attached data, modules,etc
For further explanation you can refer this user guide from AWS on EBS: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes.html
Yes it is exactly like a hard drive on your server and you can have multiple devices.
The cool thing is that you also can expand them if you need extra space.
where things are stored when I install things like npm and node
Yes, technically ebs volume is virtual storage drive which is
connected to your instance through network, ( flash drive connected over network).
Since network is involved which implicitly means there will be some latency because of data transfer through network.
The data is persistent even if instance stops,terminates, hibernates or hardware failure.
Since it is network drive it can be attached or detached to any other instance.
Adding to this there is another type of storage which you will find called as instance store
You can specify instance store volumes for an instance only when you launch it. You can't detach an instance store volume from one instance and attach it to a different instance.
it gives very high IOPS because it is directly (physically) attached to instance.
The use case for instance store would where data changes rapidly like for cache or buffers.
Your data will be lost if any of these events happens like The underlying disk drive fails The instance stops, instance hibernates instance terminates or drive failure.

Google Cloud- New Disk while Creating VM-Redundancy Options

Referencing this as well:https://cloud.google.com/compute/docs/disks/regional-persistent-disk#repd_create_disk
It seems to imply that we cannot directly define the disk as having regional redundancy at time of creation of a VM(no such disk option visible). Only after creation of VM, we need to go to Storage Section and create disk with redundancy option and then attach it to VM.
2.Additionally,with regard to Local SSDs [which are non persistent], looks like we cannot randomly attach them while a VM is running, seems like option below appears only at time of VM creation?:
Kind regards,
Aditya
According to this article [1], regional persistent disk cannot be created as boot disk. And it need to be attached after the VM is created.
And for your second question, yes, you can add local SSD only during VM creation. According to this [2]:
"Local SSDs are located on the physical machine where your virtual machine instance is running, they can be created only during the instance creation process. Local SSDs cannot be used as boot devices"
[1] https://cloud.google.com/compute/docs/disks/regional-persistent-disk
[2] https://cloud.google.com/compute/docs/disks/local-ssd#create_local_ssd

Stop a VM instance in GCP with local SSD attached to it

According to the documentation - https://cloud.google.com/compute/docs/disks/#localssds - it is not possible to stop and instance that has a local SSD. It merely acts as a cache memory.
Is it possible to get a local SSD for an instance which is persistent and allows us to stop the instance?
Also, are local SSDs and persistent SSDs detected as different hardware types by an instance?
At this moment there's no way to setup a GCE instance with a local SSD and be able to stop it, as is mentioned in the documentation this kind of storage is used to store caches and as processing space.
Now, about the hardware differences between a local SSD and a persistent SSD. Since the point of view of the GCE instance they are the same, I mean the instance detects the two of them just as another mount; however, the technology that behind each of them it's completely different.
A local SSD, just as the documentation states, is physically attached to the server where is hosted the instance while a persistent SSD it's just a Log-Structured Volume, in other words it's not a physical hard drive.
There's a complete explanation about how persistent disks works on Google Cloud at [1].
[1] https://www.youtube.com/watch?v=jA_A-OXsIss
WARNING stopping your VM will delete all data from the local disk
You can stop the VM from ssh with the commands
sudo shutdown -h now or sudo poweroff
This is the correct way to stop the VM if it has a local ssd attached.
https://cloud.google.com/compute/docs/instances/stop-start-instance

Creating a persistent Link to an EFS drive on a Windows EC2 Server

I have created a Windows EC2 instance on AWS, and I have loaded it up with all of my needed software. My intention is to use this instance to create an image, so that I can (in the very near future) load up a much more powerful instance type using this image, and run a bunch of computations.
However, I also need to have a centralized location to store data. So, I created an EFS drive on AWS, and now I am trying to connect my instance to the EFS using a symbolic link that will persist to every other instance I load up in the future. I want to eventually have an army of instances, all of which use the centralized EFS drive as their primary storage device so that they can all load and save data, which can then be used by other instances.
I've been running Google searches all morning, but I'm coming up empty on how to do this. Any resources or tips would be greatly appreciated.
Thanks!
EFS is basically a managed NFS server. In order to mount this to a Windows instance, you will need to find an NFS client for windows.
An alternative would be to mount the EFS to a linux-based instance, and export the file system using Samba which could then be mounted on your Windows instances. Doing this you would lose out on a lot of the benefits of EFS (your linux instance is a single point of failure, and for high-bandwidth requirements will be a bottleneck) but it might be possible.
You don't say what you are trying to accomplish, but I would suggest designing a solution that would pull data from S3 as needed. That would also allow you to run multiple instances in parallel.

Google Cloud - Local SSD hadware failure?

We are planning to use Google Cloud Local SSDs, because we need better IOPS than the persistent SSD disk have. We want to build a RAID5 array with 4 disks with mdamd (Linux). My question: how can we manage hardware failure with these disks? We can't unplug these disks, because we don't have phisycal access to the server. If we remove a disk with mdamd and add a new one, will it solve this problem?
Local SSD is an ephemeral storage space and is not a reliable storage method. For example, should the machine hosting your VM suffer from a hardware failure, your data will be lost and unrecoverable. The same is true if you stop the machine on purpose or accidentally.
RAID does not help, as your instance (and Google for that matter) will lose access to the data you stored on Local SSD once the instance stops running on that machine.