0
0
AWScloud~10 mins

EC2 pricing models (on-demand, reserved, spot) in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the EC2 pricing model for an on-demand instance.

AWS
ec2_client.run_instances(InstanceType='t2.micro', MinCount=1, MaxCount=1, [1]={'MarketType':'on-demand'})
Drag options to blanks, or click blank then click option'
AInstanceMarketOptions
BMarketType
CInstanceLifecycle
DPricingModel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'PricingModel' which is not a valid parameter.
Using 'InstanceLifecycle' which is not an input parameter for run_instances.
2fill in blank
medium

Complete the code to request a spot instance using the correct market option.

AWS
ec2_client.run_instances(InstanceType='t3.medium', MinCount=1, MaxCount=1, InstanceMarketOptions={'MarketType': [1])
Drag options to blanks, or click blank then click option'
A'on-demand'
B'reserved'
C'spot'
D'scheduled'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reserved' or 'on-demand' which are different pricing models.
3fill in blank
hard

Fix the error in the code to correctly specify a reserved instance purchase option.

AWS
ec2_client.purchase_reserved_instances_offering(ReservedInstancesOfferingId='abc123', [1]=1)
Drag options to blanks, or click blank then click option'
AQuantity
BInstanceNumber
CCount
DInstanceCount
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Count' or 'InstanceCount' which are invalid for this API call.
4fill in blank
hard

Fill both blanks to configure a spot instance with a maximum price and interruption behavior.

AWS
ec2_client.run_instances(InstanceType='t3.large', MinCount=1, MaxCount=1, InstanceMarketOptions={'MarketType':'spot', 'SpotOptions':{'MaxPrice': [1], '[2]':'terminate'}})
Drag options to blanks, or click blank then click option'
A'0.05'
B'MaxPrice'
C'InstanceInterruptionBehavior'
D'0.5'
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric types instead of strings for MaxPrice.
Confusing 'MaxPrice' with interruption behavior.
5fill in blank
hard

Fill all three blanks to create a dictionary that maps instance types to their pricing models.

AWS
pricing_map = [1](instance_type: [2] for instance_type, [3] in instances.items())
Drag options to blanks, or click blank then click option'
Adict
B'on-demand'
Cpricing_model
D'spot'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'spot' instead of 'on-demand' for the pricing model.
Using wrong variable names in the comprehension.