def lambda_to_ec2()

in LambdaFunction1.js [6:31]


def lambda_to_ec2(event, context):
    response = EC2.request_spot_fleet(
        SpotFleetRequestConfig={
            'IamFleetRole': ‘<<IAM role created for Spot Instances. This should let them access S3 and cloudwatch>>’,
            'LaunchTemplateConfigs': [
              {
                'LaunchTemplateSpecification': {
                   'LaunchTemplateId': '<<ID of the Launch template created in EC2>>',
                #  'LaunchTemplateName': '<<Name of the Launch Template created>>',
                  'Version': '1'
                },
                'Overrides': [
                  {
                    'AvailabilityZone': 'us-east-1b',
                    'InstanceType':  'c4.large' ,
                    'SpotPrice': '0.4',
                    'SubnetId': '<<SUBNET ID in which you want to deploy the Spot Instances.>>'
                  },
                 
                ]
              },
              
            ],
            'SpotPrice': '0.4',
            'TargetCapacity': 1
        },