CmdID / aws / aws lightsail
aws lightsail close-instance-public-ports
Closes ports for a specific Amazon Lightsail instance. AWS CLI reference
1 example 2 options Its page in the AWS CLI reference
Examples
To close firewall ports for an instance
The following close-instance-public-ports example closes TCP port 22 on instance MEAN-2.
aws lightsail close-instance-public-ports --instance-name MEAN-2 --port-info fromPort=22,protocol=TCP,toPort=22Identify--instance-nameThe name of the instance for which to close ports.--port-infoAn object to describe the ports to close for the specified instance.Its output
{
"operation": {
"id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
"resourceName": "MEAN-2",
"resourceType": "Instance",
"createdAt": 1571072845.737,
"location": {
"availabilityZone": "us-west-2a",
"regionName": "us-west-2"
},
"isTerminal": true,
"operationDetails": "22/tcp",
"operationType": "CloseInstancePublicPorts",
"status": "Succeeded",
"statusChangedAt": 1571072845.737
}
}For more information, see Control instance traffic with firewalls in Lightsail in the Amazon Lightsail User Guide.
Options
--instance-nameThe name of the instance for which to close ports.--port-infoAn object to describe the ports to close for the specified instance.