GCP VM instances schedule is not starting the attached instance - google-cloud-platform

Last Friday I've updated daily start/stop schedule for an instance (deleted previous one and created a new one with different timing).
The instance was not changed. It's a preemptible e2-medium instance.
For some reason the schedule did not starting the VM, I also don't see any logs from it.
I did not change the permission, but just to be sure I've confirmed that the Google APIs Service Agent still has the standard Editor permission.
No other changes were made anywhere on this GCP.
I've tried to create other schedules with CRON expressions, different timezones, different instances, tried setting the initiation date. None of this worked.
The schedule zone is us-central, the instance zone is us-central1-a.
I've tried to wait for 15 minutes and more.

The problem was indeed caused by the missing permission. I had to give permission compute.instances.start to the right account
service-<my-gcp-numeric-id>#compute-system.iam.gserviceaccount.com” <- this one
<my-gcp-numeric-id>#cloudservices.gserviceaccount.com. <- not this one
But what's interesting is:
Previously (a year ago) created schedules worked fine.
The above mentioned account (service-<my-gcp-numeric-id>#) is not displayed anywhere, even after I given it persmissions.
When I create schedule on a brand new project it complains about that account missing the permission and doesn't let me attach instances, but in the original case there were no error messages.

Related

Download jupyter notebook from VM Instance that does not open anymore

I created a VM Instance on Google Cloud. Using the GPUs of this instance, I ran several experiments on Google AI Platform in a Jupyter notebook.
Now I can not start the instance anymore, since weeks I get the error that the time zone has run out of resources. However, without starting the instance I can not open the Jupyter notebooks, hence I can not download them and all my work and code is currently unavailable.
I know I could try to move the instance to a different time zone, but this seems like a tedious solution. How can I obtain those notebooks?
A couple of workarounds that can help.
Deattach the GPU from the VM instance and check if the VM instance can be started, but if not:
You can create a snapshot of the persistent disk attached to your VM Notebook, and create a VM instance from a snapshot, then access through SSH to try to recover the notebooks.
These tasks could be also a bit tedious, but you need to evaluate if you are willing to perform something like this to recover the info. In addition, you might want to contact Google Cloud Support and open a ticket since several weeks without resources seems unusual.
Even if you have the quota that doesn't mean that you will get the resources all the time. If you received an error like notfound or does not exist in zone then See Regions and zones to find out which features are available in each zone.
For now, unfortunately you need to keep try in to move the instance in different regions to get access in to those.
You also can Chat online with our Google Cloud sales team in order to get more information.
Chat is available Monday, 9 AM ET, through Friday, 7 PM ET

How can I connect to a running AWS instance when my dashboard says no instances are running?

I feel like this is a beginner question, but after messing with it for days I'm completely stumped.
I set up an instance on Amazon AWS last year, and I'd like to SSH into the instance to upgrade some software. I am unable to find the original .pem file anywhere, and everything I find to try to solve the problem — including these directions — refer to selecting the running instance on my EC2 Dashboard.
However, when I log in as a root user, it shows there are no running instances. By default it comes up as N. Virginia, but when I check the other US locations none of them show any running resources. My instance's address (the link I use for mySQL and phpMyAdmin, for example) is in the form of ec2-XXX-XXX-XXX-XXX.ca-central-1.compute.amazonaws.com, if that makes any difference.
Any ideas on next steps? I have all the data on the running instance backed up so I can recreate things as necessary. I admit that I'm a beginner with AWS (obviously) but I super-pinky-promise to store my .pem file in a safe place next time...
By default it comes up as N. Virginia, but when I check the other US
locations none of them show any running resources. My instance's
address (the link I use for mySQL and phpMyAdmin, for example) is in
the form of ec2-XXX-XXX-XXX-XXX.ca-central-1.compute.amazonaws.com, if
that makes any difference.
Your instance is running in the AWS Canada region, as indicated by the region name ca-central-1 in the address, which is why you aren't seeing it in any US region.

AWS RDS: Can't get modify of Instance Class to go through

In the AWS RDS Console using an IAM user with full permission, I selected our current RDS instance which is a db.t1.micro, clicked on "Instance Actions" and chose "Modify". I then changed both the MySQL version to 5.6.37 (current version is 5.6.34) and the Instance Class to db.t2.small. I also checked the "Apply Immediately" checkbox, and applied the modification. However, the modification didn't happen.
Instead, I'm seeing the following in the Maintenance Details for the instance:
Maintenance Window: sat:20:00-sat:20:30
Pending Modifications: DB Instance Class: db.t2.small, Engine Version: 5.6.37
Pending Maintenance: None
I figured maybe the "Apply Immediately" didn't go through, so I decided to just wait for the Maintenance window this Saturday. However, nothing happened on Saturday, and the situation remains the same.
This morning I tried using "Modify Instance" again and made sure I for sure selected the "Apply Immediately", but the result is the same.
I also tried to use the command-line interface to upgrade the instance with this command:
aws rds modify-db-instance --db-instance-identifier xxxxx --db-instance-class db.t2.small --apply-immediately
But this gives the following error (perhaps a hint?):
Service rds not available in region US West (Oregon)
The instance I tried to modify is in the US West (Oregon) region.
Any help is appreciated. I'm willing to use a different method to upgrade the instance, but I'm hoping to avoid having to change all the DB address and login settings on our websites and applications.
I solved this issue by stopping the instance with a saved snapshot and then started it again. This cleared out the "Pending Maintenance" but did not actually perform the upgrade. I then went through the "Modify" action again but only chose to modify the instance class. This time the modify happened right away and now it's the correct instance class.

Why do Spot Instances(EC2) change from cancelled_terminating to cancelled?

I have been struggling with this since last 2 days - A. Trying to create AWS Spot Instance with Deep Learning AMI for Linux (free).
B. Upon launching EC2 Instance it says Spot Instance request successfully created but it fails to create the instance.
C. Using Spot Fleet role, and later have been trying to change it to provide Admin access to this role through Policies.
However, the instance is never created and in the History tab I see Event Type = fleetRequestChange goes from Submitted, active, cancelled_terminating within a minute and later cancelled.
I have been reading through its documentation but don't see a reason for it to fail. Verified the Region and AMI as well. Tried changing bid price and with default recommended option as well. But nothing seems to work.
This is the link I'm referring - AWS setup for Deep Learning
Please skip the initial portion of getting credits and you can directly jump to EC2 instance configuration setup.
Kindly help! I am unable to proceed for the past 2 days.
Thank you!
It worked perfectly fine for me.
Launched the Deep Learning AMI (ami-df77b6a7) in the Oregon region
Spot pricing as documented in the article you referenced
I could ssh into the instance after it launched
One thing you could check... Click the Limits link in your EC2 console to confirm that you can launch this type of instance.
Mine said:
Running On-Demand g2.2xlarge instances: 5

What's the best method for creating a scheduler for running EC2 instances?

I want to create a web app for my organization where users can schedule in advance at what times they'd like their EC2 instances to start and stop (like creating events in a calendar), and those instances will be automatically started or stopped at those times. I've come across four different options:
AWS Datapipeline
Cron running on EC2 instance
Scheduled scaling of Auto Scaling Group
AWS Lambda scheduled events
It seems to me that I'll need a database to store the user's scheduled times for autostarting and autostopping an instance, and that I'll have to pull that data from the database regularly (to make sure that's the latest updated schedule). Which would be the best of the four above options for my use case?
Edit: Auto Scaling only seems to be for launching and terminating instances, so I can rule that out.
Simple!
Ask users to add a tag to their instance(s) indicating when they should start and stop (figure out some format so they can easily specify Mon-Fri or Every Day)
Create an AWS Lambda function that scans instances for their tags and starts/stops them based upon the tag content
Create an Amazon CloudWatch Event rule that triggers the Lambda function every 15 minutes (or whatever resolution you want)
You can probably find some sample code if you search for AWS Stopinator.
Take a look at ParkMyCloud if you're looking for an external SaaS app that can help your users easily schedule (or override that schedule) your EC2, RDS, and ASG instances. It also connects to SSO, provides an API, and shows you all of your resources across regions/accounts/clouds. There's a free trial available if you want to test it out.
Disclosure: I work for ParkMyCloud.