Complete the code to create a virtual server in the cloud using AWS EC2.
ec2 = boto3.resource('ec2') instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, InstanceType='[1]')
The t2.micro instance type is a common choice for beginners and small workloads in AWS EC2.
Complete the code to upload a file to AWS S3 bucket.
s3 = boto3.client('s3') s3.upload_file('localfile.txt', '[1]', 'remote.txt')
Bucket names in AWS S3 must be DNS-compliant. my-bucket is valid with hyphens.
Fix the error in the code to launch an EC2 instance with a key pair.
ec2 = boto3.resource('ec2') instance = ec2.create_instances(ImageId='ami-0abcdef1234567890', MinCount=1, MaxCount=1, KeyName='[1]')
Key pair names in AWS cannot contain spaces or dots. my-keypair is valid.
Fill both blanks to define an AWS Lambda function with correct runtime and handler.
lambda_client.create_function(FunctionName='MyFunction', Runtime='[1]', Handler='[2]', Role='arn:aws:iam::123456789012:role/lambda-role', Code={'ZipFile': b'function code bytes'})
The runtime python3.9 matches the handler app.lambda_handler for Python Lambda functions.
Fill all three blanks to create an AWS IAM policy statement allowing S3 read access.
{
'Effect': '[1]',
'Action': '[2]',
'Resource': '[3]'
}The policy Allows the s3:GetObject action on the specified bucket resource.