By using AWS re:Post, you agree to the Terms of Use
/Spot Instances/

Questions tagged with Spot Instances

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

2
answers
0
votes
55
views
asked a month ago

ClientError: An error occurred (UnknownOperationException) when calling the CreateHyperParameterTuningJob operation: The requested operation is not supported in the called region.

Hi Dears, I am building ML model using DeepAR Algorithm. I faced this error while i reached to this point : Error : ClientError: An error occurred (UnknownOperationException) when calling the CreateHyperParameterTuningJob operation: The requested operation is not supported in the called region. ------------------- Code: from sagemaker.tuner import ( IntegerParameter, CategoricalParameter, ContinuousParameter, HyperparameterTuner, ) from sagemaker import image_uris container = image_uris.retrieve(region= 'af-south-1', framework="forecasting-deepar") deepar = sagemaker.estimator.Estimator( container, role, instance_count=1, instance_type="ml.m5.2xlarge", use_spot_instances=True, # use spot instances max_run=1800, # max training time in seconds max_wait=1800, # seconds to wait for spot instance output_path="s3://{}/{}".format(bucket, output_path), sagemaker_session=sess, ) freq = "D" context_length = 300 deepar.set_hyperparameters( time_freq=freq, context_length=str(context_length), prediction_length=str(prediction_length) ) Can you please help in solving the error? I have to do that in af-south-1 region. Thanks Basem hyperparameter_ranges = { "mini_batch_size": IntegerParameter(100, 400), "epochs": IntegerParameter(200, 400), "num_cells": IntegerParameter(30, 100), "likelihood": CategoricalParameter(["negative-binomial", "student-T"]), "learning_rate": ContinuousParameter(0.0001, 0.1), } objective_metric_name = "test:RMSE" tuner = HyperparameterTuner( deepar, objective_metric_name, hyperparameter_ranges, max_jobs=10, strategy="Bayesian", objective_type="Minimize", max_parallel_jobs=10, early_stopping_type="Auto", ) s3_input_train = sagemaker.inputs.TrainingInput( s3_data="s3://{}/{}/train/".format(bucket, prefix), content_type="json" ) s3_input_test = sagemaker.inputs.TrainingInput( s3_data="s3://{}/{}/test/".format(bucket, prefix), content_type="json" ) tuner.fit({"train": s3_input_train, "test": s3_input_test}, include_cls_metadata=False) tuner.wait()
1
answers
0
votes
16
views
asked 2 months ago

EC2 Launch Template doesn't start Spot Instance (but works for on-demand instance)

My EC2 launch template doesn't work when using it to launch a Spot instance. The launch template is set to launch a c5.xlarge instance **associated to a pre-existing Elastic Network Interface** @ index 0. When launching a spot instance, I receive the following cryptic message, and the spot request fails: > c5.xlarge, ami-b2b55cd5, Linux/UNIX: A network interface may not specify both a network interface ID and a subnet First off, how can a **network interface** specify a network interface id? I believe this error means to say "a spot instance may not specify both a network interface ID and a subnet", but I can't be sure. Secondly, my launch template *doesn't* specify a subnet directly - it only specifies a network interface ID, which in turn specifies the subnet. As a troubleshooting step, I've tried launching an on-demand EC2 instance directly using the same launch template, via "**Launch Templates -> Actions -> Launch Instance from Template**" - when I do this, the EC2 instance launches successfully. I've been able to reproduce this error consistently for over 9 months now, and am surprised that no one else has brought this up. What gives? Here is my Spot config: ``` "MySpotFleet" : { "Type" : "AWS::EC2::SpotFleet", "Properties" : { "SpotFleetRequestConfigData" : { "AllocationStrategy" : "lowestPrice", "IamFleetRole" : {"Fn::GetAtt" : ["MyIAMFleetRole", "Arn"]}, "InstanceInterruptionBehavior" : "stop", "LaunchTemplateConfigs": [ { "LaunchTemplateSpecification": { "LaunchTemplateId": { "Ref" : "MyLaunchTemplate" }, "Version": { "Fn::GetAtt" : [ "MyLaunchTemplate", "LatestVersionNumber" ]} } } ], "ReplaceUnhealthyInstances" : false, "SpotMaxTotalPrice" : "5.01", "SpotPrice" : "5.01", "TargetCapacity" : 1, "TerminateInstancesWithExpiration" : false, "Type" : "maintain", "ValidFrom" : "2021-01-01T00:00:00Z", "ValidUntil" : "2050-12-31T23:59:59Z" } }, "DependsOn": [ "MyLaunchTemplate" ] } ``` If I replace the above Spot config with this on-demand instance config, it works: ``` "MyInstance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "LaunchTemplate" : { "LaunchTemplateId": { "Ref" : "MyLaunchTemplate" }, "Version": { "Fn::GetAtt" : [ "MyLaunchTemplate", "LatestVersionNumber" ]} } }, "DependsOn": [ "MyLaunchTemplate" ] } ``` If it helps, here is my Launch Template: ``` "MyLaunchTemplate" : { "Type" : "AWS::EC2::LaunchTemplate", "Properties" : { "LaunchTemplateName":"MyLaunchTemplate", "LaunchTemplateData":{ "IamInstanceProfile" : { "Arn" : { "Fn::GetAtt" : ["MyEC2IAMInstanceProfile", "Arn"] } }, "ImageId" : "ami-b2b55cd5", "InstanceType": "c5.xlarge", "NetworkInterfaces" : [ { "NetworkInterfaceId" : {"Ref" : "MyENI00"}, "DeviceIndex" : "0" } ], "InstanceInitiatedShutdownBehavior" : "stop", "KeyName" : "my-keypair" } } ``` And the ENI in question: ``` "MyENI00": { "Type": "AWS::EC2::NetworkInterface", "Properties": { "Description" : "MyENI00", "GroupSet" : [ {"Ref" : "MySecurityGroup"} ], "PrivateIpAddresses": [ { "Primary" : true, "PrivateIpAddress" : "172.16.0.100" }, { "Primary" : false, "PrivateIpAddress" : "172.16.0.101" } ], "SourceDestCheck": false, "SubnetId": { "Ref" : "MySubnet" } } } ```
0
answers
0
votes
15
views
asked 6 months ago
  • 1
  • 90 / page