AWS Service Catalog enables organizations to create and manage catalogs of products that are approved for use on AWS.
See the AWS Construct Library Module Lifecycle doc for more information about maturity levels.
See the CDK API Reference for more implementation details.
This is a 📊Tracking Issue
@SomayaB I am wondering how far is this being implemented/designed? Currently, we would like to use CDK for creating some products in a service catalog, but we're facing a major issue being that first we need to publish the YAML templates to S3.
So it would be great if it would be possible to do something like this:
import * as cdk from '@aws-cdk/core';
import { CfnCloudFormationProduct } from '@aws-cdk/aws-servicecatalog';
import { CfnParameter, CfnOutput, Fn } from '@aws-cdk/core';
import { Bucket } from '@aws-cdk/aws-s3';
class S3Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const bucketName = new CfnParameter(this, 'BucketName');
this.templateOptions.metadata = {
'AWS::CloudFormation::Interface': {
ParameterGroups: [
{
Label: { default: 'Bucket Configuration' },
Parameters: [bucketName.logicalId]
}
],
ParameterLabels: {
[bucketName.logicalId]: {
default: 'Which name should the bucket have'
}
}
}
}
const bucket = new Bucket(this, 'test-bucket', {
bucketName: bucketName.valueAsString
});
new CfnOutput(this, 'S3Id', {
value: bucket.bucketArn,
exportName: Fn.sub('${AWS::StackName}-S3Id')
})
}
}
export class EmptyCdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const product = new CfnCloudFormationProduct(this, 's3-product', {
name: 'S3 Product',
description: 'This is an s3 product',
owner: 'whoever',
provisioningArtifactParameters: [
{
info: S3Stack
}
]
});
}
}
The major issue here is that:
provisioningArtifactParameters: [
{
info: S3Stack
}
]
expects a "LoadTemplateFromURL": "https://s3.amazonaws.com/cf-templates-ozkq9d3hgiq2-us-east-1/..." property instead, being the URL a template in an S3 bucket.
If someone is reaching here and needs some light on how to achieve my previous comment until there's some development in the CDK project I put together a project to showcase it: https://github.com/AlexRex/cdk-service-catalog
The idea is to create a stack inside a stack (which won't be deployed) and get the resulting JSON template out of it (https://github.com/AlexRex/cdk-service-catalog/blob/master/src/products/s3-bucket/s3-bucket.product.ts#L11).
I hope it helps.
@AlexRex this isn't currently being worked on by the core team, but we are always accepting contributions if you're interested in pushing this forward.
You can look at the roadmap to see which modules the core team is working on developing at any given time.
Most helpful comment
If someone is reaching here and needs some light on how to achieve my previous comment until there's some development in the CDK project I put together a project to showcase it: https://github.com/AlexRex/cdk-service-catalog
The idea is to create a stack inside a stack (which won't be deployed) and get the resulting JSON template out of it (https://github.com/AlexRex/cdk-service-catalog/blob/master/src/products/s3-bucket/s3-bucket.product.ts#L11).
I hope it helps.