Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create fleet instance: InvalidParameterValue: Parameter 'amiIdList' cannot be empty. #5134

Closed
mrhello369 opened this issue Jan 7, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@mrhello369
Copy link

Describe the bug

I use the lib to create ec2 instance, it has the following error:

I0107 21:03:59.283241  698318 main.go:64] Instance: i-0e807bec4669e4866
E0107 21:04:01.495397  698318 ec2.go:73] Failed to create fleet instance: InvalidParameterValue: Parameter 'amiIdList' cannot be empty.
        status code: 400, request id: 59c0d958-b3b2-4f49-85f4-6d3d72d6a0e1
panic: InvalidParameterValue: Parameter 'amiIdList' cannot be empty.
        status code: 400, request id: 59c0d958-b3b2-4f49-85f4-6d3d72d6a0e1

goroutine 1 [running]:
main.main()
        /root/git/ec2-test/main.go:78 +0x50a
exit status 2

And I try to search this field in the lib, but I didn't find it, so I don;t know how to set it.

Expected Behavior

Create ec2 instance successful

Current Behavior

none

Reproduction Steps

ec2-test.tar.gz

1.Unzip the file.
2.Create one asg with on-demand instance.
3.go run main.go

Possible Solution

No response

Additional Information/Context

No response

SDK version used

github.com/aws/aws-sdk-go@v1.49.16

Environment details (Version of Go (go version)? OS name and version, etc.)

go version go1.20.6 linux/amd64

@mrhello369 mrhello369 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 7, 2024
@RanVaknin RanVaknin self-assigned this Jan 10, 2024
@RanVaknin
Copy link
Contributor

Hi @mrhello369 ,

Thank you for your patience.

The code sample you attached is too large. Any chance you can provide a concise snippet that raises this error?

I tried going through the ec2 model and write my own sample, but I did not see a parameter named amiIdList anywhere. If I had to guess this is an internal error leaking. What Im guessing is missing from your code is the amiId parameter. Either specified in the template, or if you are using a fleet of type "instant" you can specify amiId as an override.

input := &ec2.CreateFleetInput{
	LaunchTemplateConfigs: []*ec2.FleetLaunchTemplateConfigRequest{{
		LaunchTemplateSpecification: &ec2.FleetLaunchTemplateSpecificationRequest{
			LaunchTemplateId: aws.String("<LaunchTemplateId>"),
		},
		Overrides: []*ec2.FleetLaunchTemplateOverridesRequest{{
			ImageId: aws.String("override ImageId here"),
		}},
	}},
	TargetCapacitySpecification: &ec2.TargetCapacitySpecificationRequest{
		TotalTargetCapacity: aws.Int64(1),
	},
	Type: aws.String("instant"),
}

Can you give this a try and let me know if this works?

All the best,
Ran~

@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Feb 1, 2024
Copy link

This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants