Update a service instance - AWS Proton

Update a service instance

There are four modes for updating a service instance as described in the following list. When you use the AWS CLI, the deployment-type field defines the mode. When you use the console, these modes map to the Update spec, Update to latest minor version, and Update to latest major version actions that drop down from Actions in the service instance detail page.

NONE

In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.

CURRENT_VERSION

In this mode, the service instance is deployed and updated with the new spec that you provide. Only requested parameters are updated. Don’t include minor or major version parameters if you use this deployment-type.

MINOR_VERSION

In this mode, the service instance is deployed and updated with the published, recommended (latest) minor version of the current major version in use by default. You can also specify a different minor version of the current major version in use.

MAJOR_VERSION

In this mode, the service instance is deployed and updated with the published, recommended (latest) major and minor version of the current template by default. You can also specify a different major version that is higher than the major version in use and a minor version (optional).

You can attempt to cancel a service instance update deployment if the deploymentStatus is IN_PROGRESS. When you do this, AWS Proton attempts to cancel the deployment. Successful cancellation isn’t guaranteed.

When you cancel an update deployment, AWS Proton attempts to cancel the deployment as listed in the following steps.

  • Sets the deployment state to CANCELLING.

  • Stops the deployment in process and deletes any new resources that were created by the deployment when IN_PROGRESS.

  • Sets the deployment state to CANCELLED.

  • Reverts the state of the resource to what it was before the deployment was started.

For more information on cancelling a service instance deployment, see CancelServiceInstanceDeployment in the AWS Proton API Reference.

Update a service instance using the console by following these steps.

  1. From the AWS Proton console, choose Service instances in the left-hand menu.

  2. In the list of service instances, choose the name of the service instance that you want to update.

  3. Choose Actions and then choose one of the update options, Update spec, Update to latest minor version, or Update to latest major version.

  4. Fill out each form and choose Next until you reach the Review page.

  5. Review your edits and choose Update.

The following example commands and responses show how to use the AWS CLI to update a service instance to a new minor version.

Command: to update

aws proton update-service-instance --name "instance-one" --service-name "simple-svc" --spec "file://service-spec.yaml" --template-major-version "1" --template-minor-version "1" --deployment-type "MINOR_VERSION"

Response:

{ "serviceInstance": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/service-instance/instance-one", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "IN_PROGRESS", "environmentName": "arn:aws:proton:region-id:123456789012:environment/simple-env", "lastDeploymentAttemptedAt": "2021-04-02T21:38:00.823000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:29:59.962000+00:00", "name": "instance-one", "serviceName": "simple-svc", "templateMajorVersion": "1", "templateMinorVersion": "0", "templateName": "svc-simple" } }

Command: to get and confirm status

aws proton get-service-instance --name "instance-one" --service-name "simple-svc"

Response:

{ "serviceInstance": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/service-instance/instance-one", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "SUCCEEDED", "environmentName": "simple-env", "lastDeploymentAttemptedAt": "2021-04-02T21:38:00.823000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:38:00.823000+00:00", "name": "instance-one", "serviceName": "simple-svc", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"kls-simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" } }

Use the console to cancel a service instance deployment as shown in the following steps.

  1. In the AWS Proton console, choose Service instances in the navigation pane.

  2. In the list of service instances, choose the name of the service instance with the deployment update that you want to cancel.

  3. If your update deployment status is In progress, on the service instance detail page, choose Actions and then Cancel deployment.

  4. A modal asks you to confirm the cancellation. Choose Cancel deployment.

  5. Your update deployment status is set to Cancelling and then Cancelled to complete the cancellation.

Use the AWS Proton AWS CLI to cancel an IN_PROGRESS service instance update deployment to a new minor version 2 as shown in the following commands and responses.

A wait condition is included in the template used for this example so that the cancellation starts before the update deployment succeeds.

Command: to cancel

aws proton cancel-service-instance-deployment --service-instance-name "instance-one" --service-name "simple-svc"

Response:

{ "serviceInstance": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/service-instance/instance-one", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "CANCELLING", "environmentName": "simple-env", "lastDeploymentAttemptedAt": "2021-04-02T21:45:15.406000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:38:00.823000+00:00", "name": "instance-one", "serviceName": "simple-svc", "spec": "proton: ServiceSpec\npipeline:\n my_sample_pipeline_optional_input: abc\n my_sample_pipeline_required_input: '123'\ninstances:\n- name: my-instance\n environment: MySimpleEnv\n spec:\n my_sample_service_instance_optional_input: def\n my_sample_service_instance_required_input: '456'\n- name: my-other-instance\n environment: MySimpleEnv\n spec:\n my_sample_service_instance_required_input: '789'\n", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" } }

Command: to get and confirm status

aws proton get-service-instance --name "instance-one" --service-name "simple-svc"

Response:

{ "serviceInstance": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/service-instance/instance-one", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "CANCELLED", "deploymentStatusMessage": "User initiated cancellation.", "environmentName": "simple-env", "lastDeploymentAttemptedAt": "2021-04-02T21:45:15.406000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:38:00.823000+00:00", "name": "instance-one", "serviceName": "simple-svc", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"kls-simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" } }