Skip to content

Commit 46dddaa

Browse files
authored
Merge pull request #667 from aws-samples/fix/seedfarmer-metadata
feat(metadata): Add metadata output for Nexus integration
2 parents 93397c7 + 46ac89b commit 46dddaa

File tree

5 files changed

+126
-2
lines changed

5 files changed

+126
-2
lines changed

aws-genai-llm-chatbot/modules/chatbot/deployspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ deploy:
1111
- npm run config -- --non-interactive --env-prefix NEXUS_PARAMETER_
1212
- npm run deploy -- --require-approval never --progress events --outputs-file ./cdk-exports.json -v
1313
- cat cdk-exports.json
14-
- seedfarmer metadata convert -f cdk-exports.json || true
14+
- seedfarmer metadata convert -f cdk-exports.json -jq .${NEXUS_PARAMETER_PREFIX}GenAIChatBotStack.metadata || true
1515
destroy:
1616
phases:
1717
build:

lib/aws-genai-llm-chatbot-stack.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,5 +626,28 @@ export class AwsGenAILLMChatbotStack extends cdk.Stack {
626626
]
627627
);
628628
}
629+
630+
new cdk.CfnOutput(this, "metadata", {
631+
value: JSON.stringify({
632+
ChatbotUserInterfaceDomainName: userInterface.cloudFrontDistribution
633+
?.distributionDomainName
634+
? `https://${userInterface.cloudFrontDistribution?.distributionDomainName}`
635+
: "",
636+
ChatbotUserPoolId: authentication.userPool.userPoolId,
637+
ChatbotUserPoolClientId: authentication.userPoolClient.userPoolClientId,
638+
ChatbotUserPoolLink: `https://${cdk.Stack.of(this).region}.console.aws.amazon.com/cognito/v2/idp/user-pools/${authentication.userPool.userPoolId}/users?region=${cdk.Stack.of(this).region}`,
639+
ChatbotGraphqlApiUrl: chatBotApi.graphqlApi.graphqlUrl,
640+
ChatbotGraphQLApiId: chatBotApi.graphqlApi.apiId,
641+
ChatbotApiKeysSecretName: shared.apiKeysSecret.secretName,
642+
ChatbotLoadBalancerDNS: userInterface.privateWebsite
643+
? userInterface.privateWebsite?.loadBalancer.loadBalancerDnsName
644+
: "",
645+
ChatbotDomain: userInterface.publishedDomain,
646+
ChatbotCompositeAlarmTopicOutput:
647+
monitoringConstruct.compositeAlarmTopic
648+
? monitoringConstruct.compositeAlarmTopic.topicName
649+
: "",
650+
}),
651+
});
629652
}
630653
}

lib/user-interface/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface UserInterfaceProps {
3131
export class UserInterface extends Construct {
3232
public readonly publishedDomain: string;
3333
public readonly cloudFrontDistribution?: cf.IDistribution;
34+
public readonly privateWebsite?: PrivateWebsite;
3435

3536
constructor(scope: Construct, id: string, props: UserInterfaceProps) {
3637
super(scope, id);
@@ -73,7 +74,7 @@ export class UserInterface extends Construct {
7374
let redirectSignIn: string;
7475

7576
if (props.config.privateWebsite) {
76-
new PrivateWebsite(this, "PrivateWebsite", {
77+
this.privateWebsite = new PrivateWebsite(this, "PrivateWebsite", {
7778
...props,
7879
websiteBucket: websiteBucket,
7980
});

lib/user-interface/private-website.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export interface PrivateWebsiteProps {
2222
}
2323

2424
export class PrivateWebsite extends Construct {
25+
public readonly loadBalancer: elbv2.ApplicationLoadBalancer;
26+
2527
constructor(scope: Construct, id: string, props: PrivateWebsiteProps) {
2628
super(scope, id);
2729

@@ -154,6 +156,7 @@ export class PrivateWebsite extends Construct {
154156
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
155157
}),
156158
});
159+
this.loadBalancer = loadBalancer;
157160

158161
const albLogBucket = new s3.Bucket(this, "ALBLoggingBucket", {
159162
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,

tests/__snapshots__/cdk-app.test.ts.snap

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,103 @@ exports[`snapshot test with CMK 1`] = `
279279
],
280280
},
281281
},
282+
"metadata": {
283+
"Value": {
284+
"Fn::Join": [
285+
"",
286+
[
287+
"{"ChatbotUserInterfaceDomainName":"","ChatbotUserPoolId":"",
288+
{
289+
"Ref": "AuthenticationUserPool28698864",
290+
},
291+
"","ChatbotUserPoolClientId":"",
292+
{
293+
"Ref": "AuthenticationUserPoolUserPoolClient8AE1704E",
294+
},
295+
"","ChatbotUserPoolLink":"https://us-east-1.console.aws.amazon.com/cognito/v2/idp/user-pools/",
296+
{
297+
"Ref": "AuthenticationUserPool28698864",
298+
},
299+
"/users?region=us-east-1","ChatbotGraphqlApiUrl":"",
300+
{
301+
"Fn::GetAtt": [
302+
"ChatBotApiChatbotApiBABF9B87",
303+
"GraphQLUrl",
304+
],
305+
},
306+
"","ChatbotGraphQLApiId":"",
307+
{
308+
"Fn::GetAtt": [
309+
"ChatBotApiChatbotApiBABF9B87",
310+
"ApiId",
311+
],
312+
},
313+
"","ChatbotApiKeysSecretName":"",
314+
{
315+
"Fn::Join": [
316+
"-",
317+
[
318+
{
319+
"Fn::Select": [
320+
0,
321+
{
322+
"Fn::Split": [
323+
"-",
324+
{
325+
"Fn::Select": [
326+
6,
327+
{
328+
"Fn::Split": [
329+
":",
330+
{
331+
"Ref": "SharedApiKeysSecret9EA666ED",
332+
},
333+
],
334+
},
335+
],
336+
},
337+
],
338+
},
339+
],
340+
},
341+
{
342+
"Fn::Select": [
343+
1,
344+
{
345+
"Fn::Split": [
346+
"-",
347+
{
348+
"Fn::Select": [
349+
6,
350+
{
351+
"Fn::Split": [
352+
":",
353+
{
354+
"Ref": "SharedApiKeysSecret9EA666ED",
355+
},
356+
],
357+
},
358+
],
359+
},
360+
],
361+
},
362+
],
363+
},
364+
],
365+
],
366+
},
367+
"","ChatbotLoadBalancerDNS":"",
368+
{
369+
"Fn::GetAtt": [
370+
"UserInterfacePrivateWebsiteALB67ED856F",
371+
"DNSName",
372+
],
373+
},
374+
"","ChatbotDomain":"","ChatbotCompositeAlarmTopicOutput":""}",
375+
],
376+
],
377+
},
378+
},
282379
},
283380
"Parameters": {
284381
"BootstrapVersion": {

0 commit comments

Comments
 (0)