UpdateContainerService
Updates the configuration of your Amazon Lightsail container service, such as its power, scale, and public domain names.
Request Syntax
{
"isDisabled": boolean
,
"power": "string
",
"publicDomainNames": {
"string
" : [ "string
" ]
},
"scale": number
,
"serviceName": "string
"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- isDisabled
-
A Boolean value to indicate whether the container service is disabled.
Type: Boolean
Required: No
- power
-
The power for the container service.
The power specifies the amount of memory, vCPUs, and base monthly cost of each node of the container service. The
power
andscale
of a container service makes up its configured capacity. To determine the monthly price of your container service, multiply the base price of thepower
with thescale
(the number of nodes) of the service.Use the
GetContainerServicePowers
action to view the specifications of each power option.Type: String
Valid Values:
nano | micro | small | medium | large | xlarge
Required: No
- publicDomainNames
-
The public domain names to use with the container service, such as
example.com
andwww.example.com
.You can specify up to four public domain names for a container service. The domain names that you specify are used when you create a deployment with a container configured as the public endpoint of your container service.
If you don't specify public domain names, then you can use the default domain of the container service.
Important You must create and validate an SSL/TLS certificate before you can use public domain names with your container service. Use the
CreateCertificate
action to create a certificate for the public domain names you want to use with your container service.You can specify public domain names using a string to array map as shown in the example later on this page.
Type: String to array of strings map
Required: No
- scale
-
The scale for the container service.
The scale specifies the allocated compute nodes of the container service. The
power
andscale
of a container service makes up its configured capacity. To determine the monthly price of your container service, multiply the base price of thepower
with thescale
(the number of nodes) of the service.Type: Integer
Valid Range: Minimum value of 1. Maximum value of 20.
Required: No
- serviceName
-
The name of the container service to update.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 63.
Pattern:
^[a-z0-9]{1,2}|[a-z0-9][a-z0-9-]+[a-z0-9]$
Required: Yes
Response Syntax
{
"containerService": {
"arn": "string",
"containerServiceName": "string",
"createdAt": number,
"currentDeployment": {
"containers": {
"string" : {
"command": [ "string" ],
"environment": {
"string" : "string"
},
"image": "string",
"ports": {
"string" : "string"
}
}
},
"createdAt": number,
"publicEndpoint": {
"containerName": "string",
"containerPort": number,
"healthCheck": {
"healthyThreshold": number,
"intervalSeconds": number,
"path": "string",
"successCodes": "string",
"timeoutSeconds": number,
"unhealthyThreshold": number
}
},
"state": "string",
"version": number
},
"isDisabled": boolean,
"location": {
"availabilityZone": "string",
"regionName": "string"
},
"nextDeployment": {
"containers": {
"string" : {
"command": [ "string" ],
"environment": {
"string" : "string"
},
"image": "string",
"ports": {
"string" : "string"
}
}
},
"createdAt": number,
"publicEndpoint": {
"containerName": "string",
"containerPort": number,
"healthCheck": {
"healthyThreshold": number,
"intervalSeconds": number,
"path": "string",
"successCodes": "string",
"timeoutSeconds": number,
"unhealthyThreshold": number
}
},
"state": "string",
"version": number
},
"power": "string",
"powerId": "string",
"principalArn": "string",
"privateDomainName": "string",
"publicDomainNames": {
"string" : [ "string" ]
},
"resourceType": "string",
"scale": number,
"state": "string",
"tags": [
{
"key": "string",
"value": "string"
}
],
"url": "string"
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- containerService
-
An object that describes a container service.
Type: ContainerService object
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.
HTTP Status Code: 400
- InvalidInputException
-
Lightsail throws this exception when user input does not conform to the validation rules of an input field.
Note Domain and distribution APIs are only available in the N. Virginia (
us-east-1
) AWS Region. Please set your AWS Region configuration tous-east-1
to create, view, or edit these resources.HTTP Status Code: 400
- NotFoundException
-
Lightsail throws this exception when it cannot find a resource.
HTTP Status Code: 400
- ServiceException
-
A general service exception.
HTTP Status Code: 500
- UnauthenticatedException
-
Lightsail throws this exception when the user has not been authenticated.
HTTP Status Code: 400
Examples
In the following example or examples, the Authorization header contents
(AUTHPARAMS
) must be replaced with an AWS Signature Version 4
signature. For more information about creating these signatures, see Signature
Version 4 Signing Process in the AWS General
Reference.
You need to learn how to sign HTTP requests only if you intend to manually
create them. When you use the AWS Command Line
Interface (AWS CLI)
Update container service
The following example updates an existing container service named
container-service-1
in the us-west-2
AWS Region by adding
specifying the example.com
, applications.example.com
,
www.example.com
, and containers.example.com
public domains of
the example-com
SSL/TLS certificate.
Sample Request
POST / HTTP/1.1
Host: lightsail.us-west-2.amazonaws.com
Accept-Encoding: identity
X-Amz-Target: Lightsail_20161128.UpdateContainerService
Content-Type: application/x-amz-json-1.1
User-Agent: AGENT
X-Amz-Date: 20201022T203059Z
Authorization: AUTHPARAMS
Content-Length: 192
{
"serviceName": "myservice",
"isDisabled": false,
"publicDomainNames": {
"example-com": [
"example.com",
"applications.example.com",
"www.example.com",
"containers.example.com"
]
}
}
Sample Response
HTTP/1.1 200 OK
Server: Server
Date: Thu, 22 Oct 2020 20:31:00 GMT
Content-Type: application/x-amz-json-1.1
Content-Length: 1178
x-amzn-RequestId: d198e00c-70c7-47e4-afa7-2EXAMPLE6f5a
Connection: keep-alive
{
"containerService": {
"arn": "arn:aws:lightsail:us-west-2:111122223333:ContainerService/1724babe-944a-4c49-887a-e7EXAMPLEe34",
"containerServiceName": "myservice",
"createdAt": 1.602859922E9,
"currentDeployment": {
"containers": {
"mystaticwebsite": {
"command": [],
"environment": {},
"image": "httpd",
"ports": {"80": "HTTP"}
}
},
"createdAt": 1.603393327E9,
"publicEndpoint": {
"containerName": "mystaticwebsite",
"containerPort": 80,
"healthCheck": {
"healthyThreshold": 2,
"intervalSeconds": 5,
"path": "/",
"successCodes": "200-499",
"timeoutSeconds": 2,
"unhealthyThreshold": 2
}
},
"state": "ACTIVE",
"version": 5
},
"isDisabled": false,
"location": {
"availabilityZone": "all",
"regionName": "us-west-2"
},
"power": "nano",
"powerId": "nano-1",
"principalArn": "arn:aws:iam::111122223333:role/amazon/lightsail/us-west-2/containers/myservice/1blaioEXAMPLEa1td8sgmnvhmoEXAMPLE8tetach1pcir6773v4g",
"privateDomainName": "myservice.service.local",
"publicDomainNames": {
"example-com": [
"example.com",
"applications.example.com",
"www.example.com",
"containers.example.com"
]
},
"resourceType": "ContainerService",
"scale": 1,
"state": "UPDATING",
"tags": [],
"url": "https://myservice.urEXAMPLE1234.us-west-2.cs.amazonlightsail.com/"
}
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: