Update the stack - AWS Perspective

Update the stack

To upgrade to the lastest version of the AWS Perspective solution, use the AWS Management Console or the AWS Command Line Interface (AWS CLI).

Using the AWS Management Console

  1. Download the template for AWS Perspective.

  2. Before beginning the upgrade, you must deactivate the discovery process. Sign in to the Amazon Elastic Container Service console.

  3. Select the cluster named aws-perspective-<account-number>-cluster.

  4. Select Scheduled Tasks.

  5. Select aws-perspective-<account-number>-rule.

  6. Choose Edit.

  7. Uncheck the Schedule rule enabled checkbox and choose Update.

  8. Sign in to the AWS CloudFormation console.

  9. Select the stack with the name provided during deployment and choose Update stack.

  10. Select the Replace current template radio box, then select the Upload a template file radio box and upload the file downloaded in step 1.

  11. Choose Next.

  12. Under Parameters, the following new parameters have been added. Review the default parameters for this solution template and modify them as necessary.

    Parameter Default Description
    ElasticsearchInstanceType

    m6g.large.elasticsearch

    The instance type that will be used for your Elasticsearch data nodes. What you select here affects the cost of running the solution. Note, the default value will upgrade the instance type of the cluster from the previous default of m4.large.elasticsearch. If you continue using the same instance type, you must enter the instance type that the deployed cluster is currently using.

    CreateAPIGatewayCloudWatchLogsRole

    Yes

    If set to Yes, Perspective will create a role and overwrite the existing ApiGateway Account CloudWatchLogsRoleArn property. Set this to No if you already have an existing role set. Refer to the Prerequisites.

  13. On the Configure stack options page, choose Next.

  14. On the Review page, review and confirm the settings. Check the boxes acknowledging that the template will create AWS Identity and Access Management (IAM) resources and require certain capabilities.

  15. Choose Update stack to deploy the stack.

After the AWS Perspective stacks have updated, restart the discovery process:

  1. Sign in to the Amazon Elastic Container Service console within the account and Region AWS Perspective is deployed.

  2. From the left-hand menu, select Repositories, then select the aws-perspective-<account-ID>-<Region>-taskstack-<UUID> stack.

  3. Copy the image tag for the latest entry in the table, for example, aws-perspective-<integer>.

  4. From the left-hand menu, select Task Definitions, then select the latest AWS Perspective task definition: aws-perspective-<account-ID>-taskgroup.

  5. Select the checkbox for the first entry in the table: aws-perspective-<account-ID>-taskgroup:<integer>, then choose Create new revision.

  6. Scroll down to Container Definitions and select aws-perspective-<account-ID>.

  7. Update the aws-perspective-<some-integer> image text after the final ':' with the image tag copied in step 3.

  8. Choose Update, then scroll down and choose Create.

  9. From the left-hand menu, select Clusters, then select the cluster named aws-perspective-<account-number>-cluster.

  10. Select Scheduled Tasks, select aws-perspective-<account-number>-rule, then choose Edit.

  11. Select the Schedule rule enabled checkbox and choose Update.

Using AWS Command Line Interface

Determine whether the AWS Command Line Interface (AWS CLI) is available in your environment. For installation instructions, refer to What Is the AWS Command Line Interface in the AWS CLI User Guide.

  1. Download the AWS Perspective CloudFormation template.

  2. Before beginning the upgrade, you must deactivate the discovery process by running the following command:

    aws events disable-rule --name aws-perspective-<account-number>-rule
  3. Run the following command in the directory the template was downloaded to:

    $ aws cloudformation update-stack --stack-name <customer-defined-stack-name> --template-body file://<downloaded-aws-perspective-template-file> --parameters ParameterKey= AdminUserEmailAddress,UsePreviousValue=true ParameterKey= AdminUserEmailAddress,UsePreviousValue=true ParameterKey= AlreadyHaveConfigSetup,UsePreviousValue=true ParameterKey= CreateElasticsearchServiceRole,UsePreviousValue=true ParameterKey= CreateNeptuneReplica,UsePreviousValue=true ParameterKey= NeptuneInstanceClass,UsePreviousValue=true ParameterKey= ElasticsearchInstanceType,ParameterValue=<instance-type> ParameterKey= OptOutOfSendingAnonymousUsageMetrics,UsePreviousValue=true
  4. After the AWS Perspective stacks have updated, update and restart the discovery Amazon ECS task. Run the following commands to create a new ECS task revision:

    TASK_DEFINITION=aws-perspective-<account-number>-taskgroup RULE_NAME=aws-perspective-<account-number>-rule NEW_TASK_DEFINTION=$(aws ecs describe-task-definition --task-definition ${TASK_DEFINITION} \ --query '{ containerDefinitions: taskDefinition.containerDefinitions, family: taskDefinition.family, taskRoleArn: taskDefinition.taskRoleArn, executionRoleArn: taskDefinition.executionRoleArn, networkMode: taskDefinition.networkMode, volumes: taskDefinition.volumes, placementConstraints: taskDefinition.placementConstraints, requiresCompatibilities: taskDefinition.requiresCompatibilities, cpu: taskDefinition.cpu, memory: taskDefinition.memory}') aws ecs register-task-definition --cli-input-json "$NEW_TASK_DEFINTION"
  5. Save the scheduled task rule description to a temporary file:

    aws events list-targets-by-rule --rule ${RULE_NAME} --query 'Targets[0]' > params.json
  6. Retrieve the scheduled task ARN and task role ARN by running the following command:

    aws ecs describe-task-definition --task-definition ${TASK_DEFINITION} \ --query '{ RoleArn: taskDefinition.taskRoleArn, TaskDefinitionArn: taskDefinition.taskDefinitionArn}'
  7. In a text editor, update the RoleArn and TaskDefinitionArn fields in params.json with the values returned in the previous step.

  8. Update the scheduled task:

    aws events put-targets --rule ${RULE_NAME} rule --targets file://params.json
  9. Reactivate the scheduled task:

    aws events enable-rule --name ${RULE_NAME}

Resources removed with stack update

When you update a previous installation of AWS Perspective, resources will be removed to reflect the changes in the architecture introduced by the new version.

The following table lists the resources removed as part of updating the stack:

Resource name Resource type
aws-perspective-<account-id>- PerspectiveCostDBTable-* AWS::DynamoDB::Table
aws-perspective-<account-id>- PerspectiveCostBucket -* AWS::S3::Bucket
aws-perspective-<account-id>-PerspectiveCostBucketPolicy -* AWS::S3::BucketPolicy
aws-perspective-<account-id>-PerspectiveCostRole -* AWS::IAM::Role
aws-perspective-<account-id>-APIGatewayAccount -* AWS:ApiGateway::Account
aws-perspective-<account-id>-ServerAPIGatewayAccount -* AWS::ApiGateway::Account
aws-perspective-<account-id>-CleanupPerspectiveCostBucket -* Custom::Setup
aws-perspective-<account-id>-APIGatewayCloudWatchLogsRole -* AWS::IAM::Role
aws-perspective-<account-id>- ServerAPIGatewayCloudWatchLogsRole -* AWS::IAM::Role