Skip to content

Migrate integration test AWS CloudFormation/AutoScaling from SDK v1 to v2#725

Draft
pjfanning wants to merge 3 commits into
apache:mainfrom
pjfanning:copilot/migrate-to-aws-sdk-v2
Draft

Migrate integration test AWS CloudFormation/AutoScaling from SDK v1 to v2#725
pjfanning wants to merge 3 commits into
apache:mainfrom
pjfanning:copilot/migrate-to-aws-sdk-v2

Conversation

@pjfanning
Copy link
Copy Markdown
Member

The aws-api-ec2 integration test used legacy com.amazonaws (SDK v1) for CloudFormation and AutoScaling, while the rest of the project already adopts software.amazon.awssdk (SDK v2).

Changes

  • project/Dependencies.scala: Extracted awsSdkV2Version = "2.42.19" constant; updated existing ecs v2 dependency to reference it
  • integration-test/aws-api-ec2/build.sbt: Replaced com.amazonaws:aws-java-sdk-cloudformation and com.amazonaws:aws-java-sdk-autoscaling with their software.amazon.awssdk equivalents (with apache-client excluded, consistent with the ECS dependency)
  • IntegrationTest.scala: Migrated CloudFormation API from v1 mutable-builder style to v2 immutable-builder pattern; updated response types and accessors

Before:

private val awsCfClient = AmazonCloudFormationClientBuilder.standard().withRegion(region).build()

val createStackRequest = new CreateStackRequest()
  .withCapabilities("CAPABILITY_IAM")
  .withStackName(stackName)
  .withParameters(new Parameter().withParameterKey("Build").withParameterValue(...))

var dsr: DescribeStacksResult = null
stack.getStackStatus == StackStatus.CREATE_COMPLETE.toString
stack.getOutputs.asScala.exists(_.getOutputKey == "AutoScalingGroupName")

After:

private val awsCfClient = CloudFormationClient.builder().region(Region.of(region)).build()

val createStackRequest = CreateStackRequest.builder()
  .capabilities(Capability.CAPABILITY_IAM)
  .stackName(stackName)
  .parameters(Parameter.builder().parameterKey("Build").parameterValue(...).build())
  .build()

var dsr: DescribeStacksResponse = null
stack.stackStatus() == StackStatus.CREATE_COMPLETE
stack.outputs().asScala.exists(_.outputKey() == "AutoScalingGroupName")

@pjfanning pjfanning marked this pull request as draft March 26, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants