0
0
AWScloud~10 mins

Launching an EC2 instance 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 Amazon Machine Image (AMI) ID when launching an EC2 instance.

AWS
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(ImageId='[1]', MinCount=1, MaxCount=1, InstanceType='t2.micro')
Drag options to blanks, or click blank then click option'
Aami-0abcdef1234567890
Bkey-pair
Csecurity-group
Dinstance-type
Attempts:
3 left
💡 Hint
Common Mistakes
Using instance type or security group instead of AMI ID.
2fill in blank
medium

Complete the code to specify the instance type when launching an EC2 instance.

AWS
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, InstanceType='[1]')
Drag options to blanks, or click blank then click option'
Aami-0abcdef1234567890
Bsg-12345678
Ct2.micro
Dmy-key-pair
Attempts:
3 left
💡 Hint
Common Mistakes
Using AMI ID or security group ID instead of instance type.
3fill in blank
hard

Fix the error in the code by filling the correct parameter name for the key pair when launching an EC2 instance.

AWS
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, InstanceType='t2.micro', [1]='my-key-pair')
Drag options to blanks, or click blank then click option'
AKeyPair
BKeyName
CKey
DKeyId
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like 'KeyPair' or 'Key'.
4fill in blank
hard

Fill both blanks to add a security group and a tag to the EC2 instance.

AWS
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, InstanceType='t2.micro', SecurityGroupIds=['[1]'], TagSpecifications=[{'ResourceType': 'instance', 'Tags': [{'Key': 'Name', 'Value': '[2]'}]}])
Drag options to blanks, or click blank then click option'
Asg-12345678
BMyInstance
Cami-0abcdef1234567890
Dt2.micro
Attempts:
3 left
💡 Hint
Common Mistakes
Using AMI ID or instance type as security group.
Confusing tag key and value.
5fill in blank
hard

Fill all three blanks to create an EC2 instance with a specific subnet, assign a public IP, and add a tag.

AWS
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, InstanceType='t2.micro', NetworkInterfaces=[{'SubnetId': '[1]', 'DeviceIndex': 0, 'AssociatePublicIpAddress': [2]], TagSpecifications=[{'ResourceType': 'instance', 'Tags': [{'Key': 'Name', 'Value': '[3]'}]}])
Drag options to blanks, or click blank then click option'
Asubnet-1a2b3c4d
BTrue
CWebServer
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect subnet ID format.
Using string 'True' instead of boolean True.