Managing AWS instances

Now, we're ready to create our first virtual machine using boto3. As we have discussed, we need the AMI that we will instantiate an instance from. Think of an AMI as a Python class; creating an instance will create an object from it. We will use the Amazon Linux AMI, which is a special Linux operating system maintained by Amazon and used for deploying Linux machines without any extra charges. You can find a full AMI ID, per region, at https://aws.amazon.com/amazon-linux-ami/:

import boto3ec2 = boto3.resource('ec2')instance = ec2.create_instances(ImageId='ami-824c4ee2', MinCount=1, MaxCount=1, InstanceType='m5.xlarge' ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.