Here is the code.
import boto3
# Create EC2 client
ec2 = boto3.client('ec2')
# Launch EC2 instance
response = ec2.run_instances(
ImageId='ami-12345678', # Replace with your AMI ID
InstanceType='t2.micro', # Specify instance type
MinCount=1,
MaxCount=1
)
print(response)