You can use userdata for passing the filename from your lambda while starting the instance.
Below is some code for the same:
import boto3
ec2 = boto3.resource('ec2')
user_data = '''#!/bin/bash
echo 'myfilename' > /tmp/s3filetodownload'''
instance = ec2.create_instances(ImageId='ami',
MinCount=1,
MaxCount=1,
KeyName='sshkey',
SecurityGroupIds=['security_group_id'],
UserData=user_data,
InstanceType='t2.micro',
SubnetId='mysubnet_id')
there are whole lots of other options available in boto3 for creating the instance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…