Write a python code to automate the prcoess of building unit virtual machines built in amazon web services to replace the manual processa)
python
Copy code
import boto3
def create_instance():
ec2 = boto3.resource('ec2')
instance = ec2.create_instances(
ImageId='ami-xxxxxxxx',
MinCount=1,
MaxCount=1,
InstanceType='t2.micro',
KeyName='your-key-pair'
)
print(f"Instance created: {instance[0].id}")
create_instance()