diff --git a/cmd/osbuild-image-tests/main_test.go b/cmd/osbuild-image-tests/main_test.go index d18d235f9..35171f07b 100644 --- a/cmd/osbuild-image-tests/main_test.go +++ b/cmd/osbuild-image-tests/main_test.go @@ -271,9 +271,20 @@ func testBootUsingAWS(t *testing.T, imagePath string) { securityGroupName, err := GenerateCIArtifactName("osbuild-image-tests-security-group-") require.NoError(t, err) + + instanceTypeForArch := map[string]string{ + "x86_64": "t3.micro", + "aarch64": "t4g.micro", + } + + instanceType, exists := instanceTypeForArch[common.CurrentArch()] + if !exists { + panic("unsupported AWS arch") + } + // boot the uploaded image and try to connect to it err = boot.WithSSHKeyPair(func(privateKey, publicKey string) error { - return boot.WithBootedImageInEC2(e, securityGroupName, imageDesc, publicKey, func(address string) error { + return boot.WithBootedImageInEC2(e, securityGroupName, imageDesc, publicKey, instanceType, func(address string) error { testSSH(t, address, privateKey, nil) return nil }) diff --git a/internal/boot/aws.go b/internal/boot/aws.go index 6fd6ac996..2c051c9ee 100644 --- a/internal/boot/aws.go +++ b/internal/boot/aws.go @@ -179,7 +179,7 @@ func DeleteEC2Image(e *ec2.EC2, imageDesc *imageDescription) error { // WithBootedImageInEC2 runs the function f in the context of booted // image in AWS EC2 -func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *imageDescription, publicKey string, f func(address string) error) (retErr error) { +func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *imageDescription, publicKey string, instanceType string, f func(address string) error) (retErr error) { // generate user data with given public key userData, err := CreateUserData(publicKey) if err != nil { @@ -224,7 +224,7 @@ func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *image MaxCount: aws.Int64(1), MinCount: aws.Int64(1), ImageId: imageDesc.Id, - InstanceType: aws.String("t3.micro"), + InstanceType: aws.String(instanceType), SecurityGroupIds: []*string{securityGroup.GroupId}, UserData: aws.String(encodeBase64(userData)), })