question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iam] The value supplied for parameter 'instanceProfileName' is not valid.

See original GitHub issue

Question

Running cdk deploy I receive the following error message:

CREATE_FAILED | AWS::ImageBuilder::InfrastructureConfiguration | TestInfrastructureConfiguration The value supplied for parameter ‘instanceProfileName’ is not valid. The provided instance profile does not exist. Please specify a different instance profile and try again. (Service: Imagebuilder, Status Code: 400, Request ID: 41f431d7-8544-48e9-9faf-a870b83b0100, Extended Request ID: null)

The C# code looks like this:

var instanceProfile = new CfnInstanceProfile(this, "TestInstanceProfile", new CfnInstanceProfileProps {
  InstanceProfileName = "test-instance-profile",
  Roles = new string[] { "TestServiceRoleForImageBuilder" }
});

var infrastructureConfiguration = new CfnInfrastructureConfiguration(this, "TestInfrastructureConfiguration", new CfnInfrastructureConfigurationProps {
  Name = "test-infrastructure-configuration",
  InstanceProfileName = instanceProfile.InstanceProfileName,
  InstanceTypes = new string[] { "t2.medium" },
  Logging = new CfnInfrastructureConfiguration.LoggingProperty {
    S3Logs = new CfnInfrastructureConfiguration.S3LogsProperty {
      S3BucketName = "s3-test-assets",
      S3KeyPrefix = "ImageBuilder/Logs"
    }
  },
  SubnetId = "subnet-12f3456f",
  SecurityGroupIds = new string[] { "sg-12b3e4e5b67f8900f" }
});

The TestServiceRoleForImageBuilder exists and was working previously. Same code was running successfully about a month ago. Any suggestions?

If I remove the CfninfrastructureConfiguration creation part, deployment runs successfully:, but takes at least 2 minutes to complete.

AwsImageBuilderStack: deploying… AwsImageBuilderStack: creating CloudFormation changeset… 0/3 | 14:24:37 | REVIEW_IN_PROGRESS | AWS::CloudFormation::Stack | AwsImageBuilderStack User Initiated 0/3 | 14:24:43 | CREATE_IN_PROGRESS | AWS::CloudFormation::Stack | AwsImageBuilderStack User Initiated 0/3 | 14:24:47 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) 0/3 | 14:24:47 | CREATE_IN_PROGRESS | AWS::IAM::InstanceProfile | TestInstanceProfile 0/3 | 14:24:47 | CREATE_IN_PROGRESS | AWS::IAM::InstanceProfile | TestInstanceProfile Resource creation Initiated 1/3 | 14:24:48 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) Resource creation Initiated 1/3 | 14:24:48 | CREATE_COMPLETE | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) 1/3 Currently in progress: AwsImageBuilderStack, TestInstanceProfile 3/3 | 14:26:48 | CREATE_COMPLETE | AWS::IAM::InstanceProfile | TestInstanceProfile 3/3 | 14:26:49 | CREATE_COMPLETE | AWS::CloudFormation::Stack | AwsImageBuilderStack

Is it probably some race condition? Should I use multiple stacks to achieve my goal?

Environment

  • CDK CLI Version: 1.73.0
  • Node.js Version: 14.13.0
  • OS: Windows 10
  • Language (Version): C# (.NET Core 3.1)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bormmcommented, Nov 24, 2020

I will repeat:

Needs to use AttrInstanceProfileName

How to make the own blog post about “A story of horrible customer support” to the reality for other peoples. “I already descriped the solution with 4 words. As you didn’t understand, I repeat the 4 words again, so we are in an endless horror support loop together now.”. Just think about that @rix0rrr

2reactions
rix0rrrcommented, Nov 23, 2020
  InstanceProfileName = instanceProfile.InstanceProfileName,

Needs to use AttrInstanceProfileName, otherwise there is no dependency between the two resources and deployment results in a race condition that sometimes works and sometimes doesn’t (depending on which resource gets created first).

Read more comments on GitHub >

github_iconTop Results From Across the Web

The value supplied for parameter 'instanceProfileName' is not ...
Since the cause seems to be AWS internal, I used a pre-created instance profile as a workaround. The profile can be either created...
Read more >
CloudFormation stack creation failing with "Value (IAM Name ...
I am using a simple CF template to create an EC2 machine, please tell me what ... with "Value (IAM Name) for parameter...
Read more >
CreateInstanceProfile - AWS Identity and Access Management
The request was rejected because an invalid or out-of-range value was supplied for an input parameter. HTTP Status Code: 400. LimitExceeded.
Read more >
CreateInstanceProfile - Amazon Identity and Access ...
The request was rejected because an invalid or out-of-range value was supplied for an input parameter. HTTP Status Code: 400. LimitExceeded.
Read more >
Invalid IAM Instance Profile - AWS - HashiCorp Discuss
... Value (aws_iam_instance_profile.ec2_profile.name) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found