Single instances on google clound to group of instances - google-cloud-platform

I have one instance on google clound, but the cpu usage is over 99% how can I scale or move that instance to an group I am using node js and mysql, this is possible?

You have different options to create an instance group. you can use an unmanaged instance group link to use dissimilar instances that you can arbitrarily add and remove.
Or you can create an image template and use a managed instance group link with identical instances, where you will be able to autoscale the number of instances.
But to give you a better answer, could you explain a little bit your application? Because if the only issue is the CPU usage, you can change the number of CPUs once the instance has stopped by with the edit button.

Related

Is it possible to pass in variables through an aws autoscaling group to an instance?

I am trying to spin up 2 ec2 instances, that are essentially the exact same server, except that they are differentiated by name (ie. server-01 and server-02). I'm using an autoscaling group to make sure that if an instance crashes, that a new one spins up automatically. Also, the launch script that is passed to each instance includes their hostname (server-01 etc.) that is needed for a configuration file. It would be a lot cleaner to just have one asg with 2 concurrent instances that passes this variable into the individual instances, but then there is the issue of first, is it even possible to pass in a variable into an asg launch script, and then if one instance goes down, wouldn't the variable then go to server-03 for example?
To me, it seems that I need to create 2 asgs each with a single instance, but I was wondering of the above is possible? Thanks!
If your two Amazon EC2 instances are performing different functions then, yes, it would be correct to use two different Auto Scaling groups.
When multiple instances are launched under one Auto Scaling group, it is expected that each instance is performing an identical function. There should certainly be no need to give each instance a specific reference number (eg 1, 2) and have a replacement instance assume that number.
The alternative is to have each instance inspect the environment at startup. It could DescribeInstances() with a tag of the Auto Scaling group to discover currently-running instances in the group. Then, you could use Name tags to track what each instance is doing. For example, if it sees that there is only Server-2 running, then it should assume that it needs to take the place of Server-1.
Much better to either use separate Auto Scaling groups or make each instance identical.

AWS Questions surrounding instance creation

Good Morning i have questions surrounding AWS
Question One
Can i create a single instance that is used specifically for DEV that can be used by multiple developers EG one instance but can cater for multiple projects baseline for ENV should be PHP for example
how do i then specify an instance for a client to be able to test based on question one
how do i then provision a instance for a clients live environment
I want to create template that i can use for this or do i need to create a instance every time to complete the above tasks
Question Two
Can i achieve the above using Elastic beanstalk is it cheaper and more practical
Thank you
I would think you just simply launch one instance for each of your use cases, set the necessary security group and public ips(elastic IP) to allow for those users. And then production environment in its on VPC or at least subnet and with a back up in a second availability zone?
Hard to give any specific advise without more details on the respective requirements.

Google Cloud cancel replacing instances in group

How is it possible to cancel replacing instances in instance group without website going offline? We have a managed instance group of compute engine instances, we start replace operation with maximum unavailable instances set to 0, if new instance for some reason doesn't become healthy there is an option to remove instance. However it removes all instances making website to go down until a new instance is created. Is it supposed to happen?
This seems to be expected behavior. Please have a look at rolling update in order to update your instance. Striving for 0 downtime could be achievable. To make your servers more responsive and less disruptive, you may consider the following two strategies:
Max surge. This will create instances above the target size in order to speed up the update process.
Opportunistic update. “An opportunistic update is only applied when new instances are created by the managed instance group”

Google Cloud Platform Add Instance To Managed Instance Group

It seems like the managed instance groups in the Google Cloud console should be a nice thing to use as an easy way to scale or add / remove instances. What I don't get is how to create a new instance and add it to that group? I can modify the number of instances in the Edit Group Settings page and it will create a new instance and add it to the group but I don't want a new instance automatically up and going in the group. I need to create an instance, bootstrap it, run chef-client, etc and validate that all is fine before I want the instance available in the group.
The only way I can seem to do this is to use unmanaged instance groups. This allows me to create an instance and then add it to a group.
Is there a way to do what I need using managed instance groups, since that's what Google recommends to use?
It sounds like you're trying to achieve two contradictory things:
Have Google Cloud automatically manage your instances (via a managed instance group), and
Manage your instances yourself (by manually starting instances, installing software on them, validating them etc)
You can't do both. You need to choose which of the above two things you want to achieve. If it's #1 that you're after, you need to have your instances come up without manual intervention (there are various different ways to achieve this). If it's #2 you're after, you should use unmanaged, not managed instance groups. The documentation is quite clear about this:
https://cloud.google.com/compute/docs/instance-groups/

What is the difference between an Instance and an Instance group

I was wondering what the difference between an instance and an instance group are.
Can anyone explain the difference to me?
Why can we use Autoscaler with an instance group and not with a instance
In GCE, An instance is a single virtual machine that you can customise (CPU, network, endpoint, disk, etc) and manage by you (shutdown, run, build with new image, etc)
https://cloud.google.com/compute/docs/instances/
An instance is a virtual machine hosted on Google's infrastructure.
Instances can run the Linux images provided by Google, or any
customized versions of these images. You can also build and run images
of other operating systems.
While an instance group is a collection of the instances above, for management. i.e. I have two groups, slow instances and fast instances.
Autoscaler is something that you can use with Managed Instance Group. This a group that is created by Instance Manager using an instance template.
https://cloud.google.com/compute/docs/instance-groups/
A Compute Engine Autoscaler automatically adds or removes virtual
machines from a managed instance group based on increases or decreases
in load. This allows your applications to gracefully handle increases
in traffic and reduces cost when the need for resources is lower. You
just define the autoscaling policy and the autoscaler performs
automatic scaling based on the measured load.
Hope it helps.
Cheers.