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.

[neptune] AssociatedRoles for CfnDBCluster

See original GitHub issue

AssociatedRoles is now supported by CF templates for Amazon Neptune, but not available in the CDK (as of v1.62.0).

Use Case

Associating an IAM role with a Neptune’s CfnDBCluster.

Proposed Solution

Should be possible as AssociatedRoles is available for other types of DBCluster.

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
njlynchcommented, Sep 30, 2020

Ah, I see it now.

tl;dr - Here’s the fix to your code:

CfnDBCluster.DBClusterRoleProperty clusterRole = new CfnDBCluster.DBClusterRoleProperty.Builder().
    roleArn(associatedRole.getRoleArn()).
    build();

return CfnDBCluster.Builder.create(this, "NeptuneCluster").
    // ...
    associatedRoles(Arrays.asList(clusterRole)).
    // ...
    .build();

The associated roles isn’t just an IAM Role, it’s a specific type expected by CloudFormation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-associatedroles

The Java docs are not helpful here, showing the type of associatedRoles as java.util.List<? extends java.lang.Object>. https://docs.aws.amazon.com/cdk/api/latest/java/software/amazon/awscdk/services/neptune/CfnDBCluster.Builder.html#associatedRoles-java.util.List- . What it should be is java.util.List<CfnDBCluster.DBClusterRoleProperty>. https://docs.aws.amazon.com/cdk/api/latest/java/software/amazon/awscdk/services/neptune/CfnDBCluster.DBClusterRoleProperty.html

If you look at the Typescript or Python docs, you’ll see slightly more helpful types:

  • Typescript - Type: IResolvable | DBClusterRoleProperty | IResolvable[]
  • Python - Union[IResolvable, List[Union[DBClusterRoleProperty, IResolvable]], None]

I am really intrigued by the bad error message you got, and by the poor Java docs in this example. I’ll follow up on our jsii project – responsible for both – and see if we can’t make some improvements.

Either way, hopefully this gets you up and running now.

1reaction
njlynchcommented, Sep 10, 2020

This is being done as part of #10201. Closing this out as a duplicate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

class CfnDBCluster (construct) · AWS CDK
Create a new AWS::Neptune::DBCluster . Construct Props. Name, Type, Description. associatedRoles? IResolvable | ...
Read more >
awsneptune - Go Packages
Amazon Neptune Construct Library. This module is part of the AWS Cloud Development Kit project. import neptune "github.com/aws/aws-cdk-go/awscdk".
Read more >
awslabs/aws-cdk - Gitter
I've got this Role which I want to use to load RDF into Neptune: ... CfnDBCluster.Builder.create(this, "NeptuneCluster"). ... associatedRoles(Arrays.
Read more >
IAM Database Authentication for Neptune - Trend Micro
Ensure that IAM Database Authentication feature is enabled for your Amazon Neptune database clusters in order to make use of AWS Identity ...
Read more >
CfnDBCluster.Builder (software.amazon.awscdk:aws-cdk-lib 2.34.1 ...
software.amazon.awscdk.services.neptune. ... Enclosing class: CfnDBCluster ... Parameters: associatedRoles - Provides a list of the Amazon Identity and ...
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