Best Python code snippet using localstack_python
Amazon_EC2_Auditor.py
Source:Amazon_EC2_Auditor.py  
...654    """[EC2.5] Serial port access to EC2 should be prohibited unless absolutely required"""655    # ISO Time656    iso8601Time = (datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat())657    # This is a failing check658    if str(ec2.get_serial_console_access_status()["SerialConsoleAccessEnabled"]) == "True":659        finding = {660            "SchemaVersion": "2018-10-08",661            "Id": awsAccountId + awsRegion + "/ec2-serial-port-access-check",662            "ProductArn": f"arn:{awsPartition}:securityhub:{awsRegion}:{awsAccountId}:product/{awsAccountId}/default",663            "GeneratorId": awsAccountId + awsRegion,664            "AwsAccountId": awsAccountId,665            "Types": [666                "Software and Configuration Checks/AWS Security Best Practices",667                "Effects/Data Exposure"668            ],669            "FirstObservedAt": iso8601Time,670            "CreatedAt": iso8601Time,671            "UpdatedAt": iso8601Time,672            "Severity": {"Label": "HIGH"},...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
