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

Support for Docker Image Assets in Service Catalog Product Stacks #31297

Open
2 tasks
dannysteenman opened this issue Sep 3, 2024 · 2 comments
Open
2 tasks
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@dannysteenman
Copy link

Describe the feature

Currently, when trying to use Docker image assets within a Service Catalog product stack, we encounter the following error:

Error: Service Catalog Product Stacks cannot use Assets
at ProductStackSynthesizer.addDockerImageAsset

Use Case

We need to deploy a lambda function as a docker container since the packages required more storage than a lambda layer supports.

Proposed Solution

In the api docs there's an example of regular assets that are supported: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicecatalog-readme.html#using-assets-in-your-product-stack

it would be nice to also support docker image assets.

Other Information

If you know of a workaround, that would be great!

Acknowledgements

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

CDK version used

2.155.0

Environment details (OS name and version, etc.)

macos

@dannysteenman dannysteenman added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 3, 2024
@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Sep 3, 2024
@pahud
Copy link
Contributor

pahud commented Sep 3, 2024

Thank you! Can you share some code snippets to help us get more context about it?

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Sep 3, 2024
@dannysteenman
Copy link
Author

dannysteenman commented Sep 3, 2024

sure:

    const portfolio = new Portfolio(this, 'rPortfolio', {
      displayName: 'portfolio',
      environment: Environment[process.env.STAGE?.toUpperCase() as keyof typeof Environment],
      managedResource: true,
      providerName: TEAM_NAME,
      shareTargetType: PortfolioShareTargetType.ALL,
    });

new lambda.DockerImageFunction(this, 'lamdaDockerFunction', {
      code: lambda.DockerImageCode.fromImageAsset(
        path.join(LAMBDA_PYTHON_DIRECTORY, 'path_to_source_containing_asset'),
        {
          platform: assets.Platform.LINUX_AMD64,
        },
      ),
      memorySize: 512,
      timeout: cdk.Duration.seconds(120),
      logRetention: logs.RetentionDays.ONE_YEAR,
    });

DummyProductStack extends servicecatalog.ProductStack

   const dummyProductStack = new DummyProductStack(this, 'DummyProductStack', {
      productMonitorRoleArn: rolearn,
      assetBucket: s3.Bucket.fromBucketName(this, 'assetbucket', this.node.tryGetContext('asset-bucket')),
    });
const dummyCfnProduct = new servicecatalog.CloudFormationProduct(this, 'DummyProduct', {
      owner: TEAM_NAME,
      distributor: TEAM_NAME,
      description: '...',
      productVersions: [
        {
          productVersionName: getProductVersion(),
          cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(dummyProductStack),
        },
      ],
      ....
      
      
 portfolio.portfolio.addProduct(dummyCfnProduct);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants