@intentius/chant-lexicon-aws 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "algorithm": "xxhash64",
3
3
  "artifacts": {
4
- "manifest.json": "d51eefde0449d6ba",
5
- "meta.json": "702f9ba9474ecce2",
6
- "types/index.d.ts": "ddfc254f5e47aba3",
4
+ "manifest.json": "4ff39217b680bc61",
5
+ "meta.json": "cccfd3efd62a4a03",
6
+ "types/index.d.ts": "49aa1b655f0e0bad",
7
7
  "rules/hardcoded-region.ts": "5c77997ce5bd34d5",
8
8
  "rules/iam-wildcard.ts": "bb0da963b2c7d640",
9
9
  "rules/s3-encryption.ts": "678cd3d490eae38",
@@ -34,5 +34,5 @@
34
34
  "skills/chant-aws.md": "81690b50e114f65a",
35
35
  "skills/chant-aws-eks.md": "93203e7255d0c16c"
36
36
  },
37
- "composite": "517a50cf553b57e8"
37
+ "composite": "a665138c12f5acf3"
38
38
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "AWS",
6
6
  "intrinsics": [
package/dist/meta.json CHANGED
@@ -55076,6 +55076,11 @@
55076
55076
  "kind": "property",
55077
55077
  "lexicon": "aws"
55078
55078
  },
55079
+ "InferenceSettings": {
55080
+ "resourceType": "AWS::MediaLive::Channel.InferenceSettings",
55081
+ "kind": "property",
55082
+ "lexicon": "aws"
55083
+ },
55079
55084
  "InfluxDBCluster": {
55080
55085
  "resourceType": "AWS::Timestream::InfluxDBCluster",
55081
55086
  "kind": "resource",
@@ -64675,6 +64680,9 @@
64675
64680
  },
64676
64681
  "DeletionProtectionEnabled": {
64677
64682
  "default": false
64683
+ },
64684
+ "BearerTokenAuthenticationEnabled": {
64685
+ "default": false
64678
64686
  }
64679
64687
  },
64680
64688
  "createOnly": [
@@ -68034,6 +68042,11 @@
68034
68042
  "kind": "property",
68035
68043
  "lexicon": "aws"
68036
68044
  },
68045
+ "MediaLiveChannel_InferenceSettings": {
68046
+ "resourceType": "AWS::MediaLive::Channel.InferenceSettings",
68047
+ "kind": "property",
68048
+ "lexicon": "aws"
68049
+ },
68037
68050
  "MediaLiveChannel_InputAttachment": {
68038
68051
  "resourceType": "AWS::MediaLive::Channel.InputAttachment",
68039
68052
  "kind": "property",
@@ -106409,6 +106422,22 @@
106409
106422
  "kind": "property",
106410
106423
  "lexicon": "aws"
106411
106424
  },
106425
+ "SqlHaStandbyDetectedInstance": {
106426
+ "resourceType": "AWS::EC2::SqlHaStandbyDetectedInstance",
106427
+ "kind": "resource",
106428
+ "lexicon": "aws",
106429
+ "attrs": {
106430
+ "HaStatus": "HaStatus",
106431
+ "SqlServerLicenseUsage": "SqlServerLicenseUsage",
106432
+ "LastUpdatedTime": "LastUpdatedTime"
106433
+ },
106434
+ "createOnly": [
106435
+ "InstanceId"
106436
+ ],
106437
+ "primaryIdentifier": [
106438
+ "InstanceId"
106439
+ ]
106440
+ },
106412
106441
  "SqlKnowledgeBaseConfiguration": {
106413
106442
  "resourceType": "AWS::Bedrock::KnowledgeBase.SqlKnowledgeBaseConfiguration",
106414
106443
  "kind": "property",
@@ -19787,6 +19787,7 @@ export declare class Logging {
19787
19787
  export declare class LogGroup {
19788
19788
  constructor(props: {
19789
19789
  Arn?: string;
19790
+ BearerTokenAuthenticationEnabled?: boolean;
19790
19791
  /** Creates a data protection policy and assigns it to the log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data. When a user who does not have permission to view masked data views a log event that includes masked data, the sensitive data is replaced by asterisks. */
19791
19792
  DataProtectionPolicy?: Record<string, unknown>;
19792
19793
  /** Indicates whether deletion protection is enabled for this log group. When enabled, deletion protection blocks all deletion operations until it is explicitly disabled. */
@@ -20555,6 +20556,7 @@ export declare class MediaLiveChannel {
20555
20556
  DryRun?: boolean;
20556
20557
  EncoderSettings?: MediaLiveChannel_EncoderSettings;
20557
20558
  Id?: string;
20559
+ InferenceSettings?: MediaLiveChannel_InferenceSettings;
20558
20560
  InputAttachments?: MediaLiveChannel_InputAttachment[];
20559
20561
  Inputs?: string[];
20560
20562
  InputSpecification?: MediaLiveChannel_InputSpecification;
@@ -30982,6 +30984,19 @@ export declare class SpotFleet {
30982
30984
  readonly Id: string;
30983
30985
  }
30984
30986
 
30987
+ export declare class SqlHaStandbyDetectedInstance {
30988
+ constructor(props: {
30989
+ InstanceId: string;
30990
+ HaStatus?: SqlHaStandbyDetectedInstance_HaStatus;
30991
+ LastUpdatedTime?: string;
30992
+ SqlServerCredentials?: string;
30993
+ SqlServerLicenseUsage?: SqlHaStandbyDetectedInstance_SqlServerLicenseUsage;
30994
+ }, attributes?: CFResourceAttributes);
30995
+ readonly HaStatus: SqlHaStandbyDetectedInstance_HaStatus;
30996
+ readonly LastUpdatedTime: string;
30997
+ readonly SqlServerLicenseUsage: SqlHaStandbyDetectedInstance_SqlServerLicenseUsage;
30998
+ }
30999
+
30985
31000
  export declare class SSMAssociation {
30986
31001
  constructor(props: {
30987
31002
  /** The name of the SSM document. */
@@ -90421,6 +90436,12 @@ export declare class InferenceScheduler_Tag {
90421
90436
  });
90422
90437
  }
90423
90438
 
90439
+ export declare class InferenceSettings {
90440
+ constructor(props: {
90441
+ FeedArn?: string;
90442
+ });
90443
+ }
90444
+
90424
90445
  export declare class InfluxDBCluster_Tag {
90425
90446
  constructor(props: {
90426
90447
  /** The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. */
@@ -103104,6 +103125,12 @@ export declare class MediaLiveChannel_HlsWebdavSettings {
103104
103125
  });
103105
103126
  }
103106
103127
 
103128
+ export declare class MediaLiveChannel_InferenceSettings {
103129
+ constructor(props: {
103130
+ FeedArn?: string;
103131
+ });
103132
+ }
103133
+
103107
103134
  export declare class MediaLiveChannel_InputAttachment {
103108
103135
  constructor(props: {
103109
103136
  AutomaticInputFailoverSettings?: MediaLiveChannel_AutomaticInputFailoverSettings;
@@ -163061,6 +163088,14 @@ export type Space_RemoteAccess = "DISABLED" | "ENABLED";
163061
163088
 
163062
163089
  export type Space_SpaceManagedResources = "DISABLED" | "ENABLED";
163063
163090
 
163091
+ export type SqlHaStandbyDetectedInstance_HaStatus =
163092
+ | "active"
163093
+ | "invalid"
163094
+ | "processing"
163095
+ | "standby";
163096
+
163097
+ export type SqlHaStandbyDetectedInstance_SqlServerLicenseUsage = "full" | "waived";
163098
+
163064
163099
  export type StackSet_Capability =
163065
163100
  | "CAPABILITY_AUTO_EXPAND"
163066
163101
  | "CAPABILITY_IAM"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-aws",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "AWS CloudFormation lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -47,7 +47,7 @@
47
47
  "js-yaml": "^4.1.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@intentius/chant": "0.1.0",
50
+ "@intentius/chant": "0.1.1",
51
51
  "typescript": "^5.9.3"
52
52
  },
53
53
  "peerDependencies": {
@@ -169,7 +169,9 @@ Reference parameters with \`Ref\`:
169
169
 
170
170
  ## Outputs
171
171
 
172
- Use \`output()\` to create explicit stack outputs. Cross-resource \`AttrRef\` usage is also auto-detected and promoted to outputs when needed.
172
+ Use \`output()\` to create explicit stack outputs. Accepts an \`AttrRef\` (resource attribute)
173
+ or any intrinsic (e.g. \`Sub\`, \`Join\`) for computed values. Cross-resource \`AttrRef\` usage
174
+ is also auto-detected and promoted to outputs when needed.
173
175
 
174
176
  {{file:docs-snippets/src/output-explicit.ts}}
175
177
 
@@ -183,6 +185,12 @@ Produces:
183
185
  }
184
186
  \`\`\`
185
187
 
188
+ Use \`Sub\` to export a computed value like a constructed URL:
189
+
190
+ \`\`\`typescript
191
+ export const solrUrl = output(Sub\`http://\${Ref(albDnsName)}/solr\`, "solrUrl");
192
+ \`\`\`
193
+
186
194
  ## Pseudo-parameters
187
195
 
188
196
  Runtime context values available in every template, accessed via the \`AWS\` namespace:
@@ -0,0 +1,90 @@
1
+ import { Composite } from "@intentius/chant";
2
+ import {
3
+ EFSFileSystem,
4
+ EFSFileSystem_ElasticFileSystemTag,
5
+ EFSAccessPoint,
6
+ EFSAccessPoint_PosixUser,
7
+ EFSAccessPoint_RootDirectory,
8
+ EFSAccessPoint_CreationInfo,
9
+ EFSAccessPoint_AccessPointTag,
10
+ SecurityGroup,
11
+ SecurityGroup_Ingress,
12
+ } from "../generated";
13
+
14
+ export interface EfsWithAccessPointProps {
15
+ name: string;
16
+ vpcId: string;
17
+ uid: string;
18
+ gid: string;
19
+ rootPath: string;
20
+ permissions?: string;
21
+ /** CIDR allowed inbound on NFS port 2049. Mutually exclusive with sourceSecurityGroupId.
22
+ * When neither ingressCidr nor sourceSecurityGroupId is set, no inline ingress rule is created
23
+ * (add a cross-stack EC2SecurityGroupIngress separately). */
24
+ ingressCidr?: string;
25
+ /** Security group ID allowed inbound on NFS port 2049. When provided, overrides ingressCidr. */
26
+ sourceSecurityGroupId?: string;
27
+ performanceMode?: "generalPurpose" | "maxIO";
28
+ throughputMode?: "bursting" | "provisioned" | "elastic";
29
+ }
30
+
31
+ export const EfsWithAccessPoint = Composite<EfsWithAccessPointProps>((props) => {
32
+ const ingressRules: SecurityGroup_Ingress[] = [];
33
+ if (props.sourceSecurityGroupId) {
34
+ ingressRules.push(new SecurityGroup_Ingress({
35
+ IpProtocol: "tcp",
36
+ FromPort: 2049,
37
+ ToPort: 2049,
38
+ SourceSecurityGroupId: props.sourceSecurityGroupId,
39
+ }));
40
+ } else if (props.ingressCidr) {
41
+ ingressRules.push(new SecurityGroup_Ingress({
42
+ IpProtocol: "tcp",
43
+ FromPort: 2049,
44
+ ToPort: 2049,
45
+ CidrIp: props.ingressCidr,
46
+ }));
47
+ }
48
+
49
+ const securityGroup = new SecurityGroup({
50
+ GroupDescription: "EFS mount target SG",
51
+ VpcId: props.vpcId,
52
+ ...(ingressRules.length > 0 ? { SecurityGroupIngress: ingressRules } : {}),
53
+ });
54
+
55
+ const nameTag = new EFSFileSystem_ElasticFileSystemTag({
56
+ Key: "Name",
57
+ Value: props.name,
58
+ });
59
+
60
+ const fs = new EFSFileSystem({
61
+ Encrypted: true,
62
+ PerformanceMode: props.performanceMode ?? "generalPurpose",
63
+ ThroughputMode: props.throughputMode ?? "bursting",
64
+ FileSystemTags: [nameTag],
65
+ });
66
+
67
+ const posixUser = new EFSAccessPoint_PosixUser({ Uid: props.uid, Gid: props.gid });
68
+
69
+ const creationInfo = new EFSAccessPoint_CreationInfo({
70
+ OwnerUid: props.uid,
71
+ OwnerGid: props.gid,
72
+ Permissions: props.permissions ?? "755",
73
+ });
74
+
75
+ const rootDirectory = new EFSAccessPoint_RootDirectory({
76
+ Path: props.rootPath,
77
+ CreationInfo: creationInfo,
78
+ });
79
+
80
+ const apNameTag = new EFSAccessPoint_AccessPointTag({ Key: "Name", Value: props.name });
81
+
82
+ const accessPoint = new EFSAccessPoint({
83
+ FileSystemId: fs.FileSystemId,
84
+ PosixUser: posixUser,
85
+ RootDirectory: rootDirectory,
86
+ AccessPointTags: [apNameTag],
87
+ });
88
+
89
+ return { securityGroup, fs, accessPoint };
90
+ }, "EfsWithAccessPoint");
@@ -6,9 +6,12 @@ import {
6
6
  EcsService_AwsVpcConfiguration,
7
7
  TaskDefinition,
8
8
  TaskDefinition_ContainerDefinition,
9
+ TaskDefinition_MountPoint,
9
10
  TaskDefinition_PortMapping,
10
11
  TaskDefinition_LogConfiguration,
11
12
  TaskDefinition_KeyValuePair,
13
+ TaskDefinition_EFSVolumeConfiguration,
14
+ TaskDefinition_Volume,
12
15
  TargetGroup,
13
16
  ListenerRule,
14
17
  ListenerRule_Action,
@@ -20,8 +23,12 @@ import {
20
23
  LogGroup,
21
24
  Role,
22
25
  Role_Policy,
26
+ ScalableTarget,
27
+ ApplicationAutoScalingScalingPolicy,
28
+ ApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration,
29
+ ApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification,
23
30
  } from "../generated";
24
- import { Sub } from "../intrinsics";
31
+ import { Sub, Join, Select, Split } from "../intrinsics";
25
32
  import { ecsTrustPolicy } from "./ecs-trust-policy";
26
33
 
27
34
  export interface FargateServiceProps {
@@ -42,8 +49,25 @@ export interface FargateServiceProps {
42
49
  cpu?: string;
43
50
  memory?: string;
44
51
  desiredCount?: number;
52
+
53
+ // Autoscaling
54
+ autoscaling?: {
55
+ minCapacity?: number;
56
+ maxCapacity: number;
57
+ cpuTarget?: number;
58
+ scaleInCooldown?: number;
59
+ scaleOutCooldown?: number;
60
+ };
45
61
  environment?: Record<string, string>;
46
62
  command?: string[];
63
+ mountPoints?: TaskDefinition_MountPoint[];
64
+ efsMounts?: Array<{
65
+ fileSystemId: string;
66
+ accessPointId?: string;
67
+ containerPath: string;
68
+ volumeName?: string;
69
+ transitEncryption?: "ENABLED" | "DISABLED";
70
+ }>;
47
71
 
48
72
  // Networking
49
73
  vpcId: string;
@@ -78,10 +102,17 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
78
102
  const logRetentionDays = props.logRetentionDays ?? 30;
79
103
  const { defaults: defs } = props;
80
104
 
105
+ // Auto-inject EFS managed policy when efsMounts are present
106
+ const EFS_POLICY = "arn:aws:iam::aws:policy/AmazonElasticFileSystemClientReadWriteAccess";
107
+ const managedPolicies = props.ManagedPolicyArns ? [...props.ManagedPolicyArns] : [];
108
+ if (props.efsMounts?.length && !managedPolicies.includes(EFS_POLICY)) {
109
+ managedPolicies.push(EFS_POLICY);
110
+ }
111
+
81
112
  // Task role — app permissions
82
113
  const taskRole = new Role(mergeDefaults({
83
114
  AssumeRolePolicyDocument: ecsTrustPolicy,
84
- ManagedPolicyArns: props.ManagedPolicyArns,
115
+ ManagedPolicyArns: managedPolicies.length > 0 ? managedPolicies : undefined,
85
116
  Policies: props.Policies,
86
117
  }, defs?.taskRole));
87
118
 
@@ -114,6 +145,27 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
114
145
  }
115
146
  }
116
147
 
148
+ // EFS volumes and mount points
149
+ const efsVolumes = (props.efsMounts ?? []).map((m, i) =>
150
+ new TaskDefinition_Volume({
151
+ Name: m.volumeName ?? `efs-${i}`,
152
+ EFSVolumeConfiguration: new TaskDefinition_EFSVolumeConfiguration({
153
+ FileSystemId: m.fileSystemId,
154
+ ...(m.accessPointId && { AuthorizationConfig: { AccessPointId: m.accessPointId } }),
155
+ TransitEncryption: m.transitEncryption ?? "ENABLED",
156
+ }),
157
+ }),
158
+ );
159
+
160
+ const efsMountPoints = (props.efsMounts ?? []).map((m, i) =>
161
+ new TaskDefinition_MountPoint({
162
+ ContainerPath: m.containerPath,
163
+ SourceVolume: m.volumeName ?? `efs-${i}`,
164
+ }),
165
+ );
166
+
167
+ const allMountPoints = [...efsMountPoints, ...(props.mountPoints ?? [])];
168
+
117
169
  const container = new TaskDefinition_ContainerDefinition({
118
170
  Name: "app",
119
171
  Image: props.image,
@@ -122,6 +174,7 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
122
174
  LogConfiguration: logConfiguration,
123
175
  Environment: environmentVars.length > 0 ? environmentVars : undefined,
124
176
  Command: props.command,
177
+ MountPoints: allMountPoints.length > 0 ? allMountPoints : undefined,
125
178
  });
126
179
 
127
180
  // Task definition
@@ -133,6 +186,7 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
133
186
  ExecutionRoleArn: props.executionRoleArn,
134
187
  TaskRoleArn: taskRole.Arn,
135
188
  ContainerDefinitions: [container],
189
+ ...(efsVolumes.length > 0 && { Volumes: efsVolumes }),
136
190
  }, defs?.taskDef));
137
191
 
138
192
  // Task security group — ingress on container port from ALB SG
@@ -228,6 +282,41 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
228
282
  { DependsOn: [rule] },
229
283
  );
230
284
 
285
+ let scalableTarget: InstanceType<typeof ScalableTarget> | undefined;
286
+ let scalingPolicy: InstanceType<typeof ApplicationAutoScalingScalingPolicy> | undefined;
287
+
288
+ if (props.autoscaling) {
289
+ const { minCapacity = 1, maxCapacity, cpuTarget = 60, scaleInCooldown, scaleOutCooldown } = props.autoscaling;
290
+
291
+ const resourceId = Join("/", ["service", Select(1, Split("/", props.clusterArn)), service.Name]);
292
+
293
+ scalableTarget = new ScalableTarget({
294
+ ServiceNamespace: "ecs",
295
+ ScalableDimension: "ecs:service:DesiredCount",
296
+ ResourceId: resourceId,
297
+ MinCapacity: minCapacity,
298
+ MaxCapacity: maxCapacity,
299
+ });
300
+
301
+ const trackingConfig = new ApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration({
302
+ TargetValue: cpuTarget,
303
+ PredefinedMetricSpecification: new ApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification({
304
+ PredefinedMetricType: "ECSServiceAverageCPUUtilization",
305
+ }),
306
+ ...(scaleInCooldown !== undefined && { ScaleInCooldown: scaleInCooldown }),
307
+ ...(scaleOutCooldown !== undefined && { ScaleOutCooldown: scaleOutCooldown }),
308
+ });
309
+
310
+ scalingPolicy = new ApplicationAutoScalingScalingPolicy({
311
+ PolicyName: Sub`\${AWS::StackName}-cpu`,
312
+ PolicyType: "TargetTrackingScaling",
313
+ ServiceNamespace: "ecs",
314
+ ScalableDimension: "ecs:service:DesiredCount",
315
+ ResourceId: resourceId,
316
+ TargetTrackingScalingPolicyConfiguration: trackingConfig,
317
+ });
318
+ }
319
+
231
320
  return {
232
321
  taskRole,
233
322
  logGroup,
@@ -236,5 +325,7 @@ export const FargateService = Composite<FargateServiceProps>((props) => {
236
325
  targetGroup,
237
326
  rule,
238
327
  service,
328
+ ...(scalableTarget ? { scalableTarget } : {}),
329
+ ...(scalingPolicy ? { scalingPolicy } : {}),
239
330
  };
240
331
  }, "FargateService");
@@ -24,3 +24,5 @@ export { FargateService } from "./fargate-service";
24
24
  export type { FargateServiceProps } from "./fargate-service";
25
25
  export { RdsInstance, RdsInstance as RdsPostgres } from "./rds-instance";
26
26
  export type { RdsInstanceProps, RdsInstanceProps as RdsPostgresProps } from "./rds-instance";
27
+ export { EfsWithAccessPoint } from "./efs-with-access-point";
28
+ export type { EfsWithAccessPointProps } from "./efs-with-access-point";
@@ -1,5 +1,12 @@
1
1
  import { Composite, mergeDefaults } from "@intentius/chant";
2
- import { Table, Table_AttributeDefinition, Table_KeySchema, Role_Policy } from "../generated";
2
+ import {
3
+ Table,
4
+ Table_AttributeDefinition,
5
+ Table_KeySchema,
6
+ Table_StreamSpecification,
7
+ Role_Policy,
8
+ EventSourceMapping,
9
+ } from "../generated";
3
10
  import { DynamoDBActions } from "../actions/dynamodb";
4
11
  import { LambdaFunction, type LambdaFunctionProps } from "./lambda-function";
5
12
 
@@ -7,9 +14,16 @@ export interface LambdaDynamoDBProps extends LambdaFunctionProps {
7
14
  tableName?: string;
8
15
  partitionKey: string;
9
16
  sortKey?: string;
10
- access?: "ReadOnly" | "ReadWrite" | "Full";
17
+ access?: "ReadOnly" | "ReadWrite" | "Full" | "None";
18
+ streams?: {
19
+ viewType?: "NEW_IMAGE" | "OLD_IMAGE" | "NEW_AND_OLD_IMAGES" | "KEYS_ONLY";
20
+ batchSize?: number;
21
+ startingPosition?: "TRIM_HORIZON" | "LATEST";
22
+ bisectOnFunctionError?: boolean;
23
+ };
11
24
  defaults?: LambdaFunctionProps["defaults"] & {
12
25
  table?: Partial<ConstructorParameters<typeof Table>[0]>;
26
+ eventSourceMapping?: Partial<ConstructorParameters<typeof EventSourceMapping>[0]>;
13
27
  };
14
28
  }
15
29
 
@@ -37,26 +51,49 @@ export const LambdaDynamoDB = Composite<LambdaDynamoDBProps>((props) => {
37
51
  BillingMode: "PAY_PER_REQUEST",
38
52
  AttributeDefinitions: attributeDefinitions,
39
53
  KeySchema: keySchema,
54
+ ...(props.streams && {
55
+ StreamSpecification: new Table_StreamSpecification({
56
+ StreamViewType: props.streams.viewType ?? "NEW_AND_OLD_IMAGES",
57
+ }),
58
+ }),
40
59
  }, defaults?.table));
41
60
 
42
61
  const access = props.access ?? "ReadWrite";
43
- const dynamoPolicyDocument = {
44
- Version: "2012-10-17",
45
- Statement: [
46
- {
47
- Effect: "Allow",
48
- Action: DynamoDBActions[access],
49
- Resource: table.Arn,
62
+ const policies: InstanceType<typeof Role_Policy>[] = [];
63
+
64
+ if (access !== "None") {
65
+ policies.push(new Role_Policy({
66
+ PolicyName: `DynamoDB${access}`,
67
+ PolicyDocument: {
68
+ Version: "2012-10-17",
69
+ Statement: [{ Effect: "Allow", Action: DynamoDBActions[access], Resource: table.Arn }],
50
70
  },
51
- ],
52
- };
71
+ }));
72
+ }
53
73
 
54
- const dynamoPolicy = new Role_Policy({
55
- PolicyName: `DynamoDB${access}`,
56
- PolicyDocument: dynamoPolicyDocument,
57
- });
74
+ if (props.streams) {
75
+ policies.push(new Role_Policy({
76
+ PolicyName: "DynamoDBStreamRead",
77
+ PolicyDocument: {
78
+ Version: "2012-10-17",
79
+ Statement: [{
80
+ Effect: "Allow",
81
+ Action: [
82
+ "dynamodb:GetRecords",
83
+ "dynamodb:GetShardIterator",
84
+ "dynamodb:DescribeStream",
85
+ "dynamodb:ListStreams",
86
+ ],
87
+ Resource: table.StreamArn,
88
+ }],
89
+ },
90
+ }));
91
+ }
92
+
93
+ if (props.Policies) {
94
+ policies.push(...props.Policies);
95
+ }
58
96
 
59
- const policies = props.Policies ? [dynamoPolicy, ...props.Policies] : [dynamoPolicy];
60
97
  const env = props.Environment ?? { Variables: {} };
61
98
  const variables = { ...((env as any).Variables ?? {}), TABLE_NAME: table.Ref };
62
99
  const { role, func } = LambdaFunction({
@@ -65,5 +102,17 @@ export const LambdaDynamoDB = Composite<LambdaDynamoDBProps>((props) => {
65
102
  Environment: { Variables: variables },
66
103
  });
67
104
 
68
- return { table, role, func };
105
+ let eventSourceMapping: InstanceType<typeof EventSourceMapping> | undefined;
106
+ if (props.streams) {
107
+ const { startingPosition = "TRIM_HORIZON", batchSize, bisectOnFunctionError } = props.streams;
108
+ eventSourceMapping = new EventSourceMapping(mergeDefaults({
109
+ FunctionName: func.Arn,
110
+ EventSourceArn: table.StreamArn,
111
+ StartingPosition: startingPosition,
112
+ ...(batchSize !== undefined && { BatchSize: batchSize }),
113
+ ...(bisectOnFunctionError !== undefined && { BisectBatchOnFunctionError: bisectOnFunctionError }),
114
+ }, defaults?.eventSourceMapping));
115
+ }
116
+
117
+ return { table, role, func, ...(eventSourceMapping ? { eventSourceMapping } : {}) };
69
118
  }, "LambdaDynamoDB");
@@ -5,33 +5,36 @@ import {
5
5
  Bucket_ServerSideEncryptionRule,
6
6
  Bucket_ServerSideEncryptionByDefault,
7
7
  Bucket_PublicAccessBlockConfiguration,
8
+ Bucket_NotificationConfiguration,
9
+ Bucket_LambdaConfiguration,
10
+ Permission,
8
11
  Role_Policy,
9
12
  } from "../generated";
10
- import { Sub } from "../intrinsics";
13
+ import { Sub, Join } from "../intrinsics";
11
14
  import { S3Actions } from "../actions/s3";
12
15
  import { LambdaFunction, type LambdaFunctionProps } from "./lambda-function";
13
16
 
14
17
  export interface LambdaS3Props extends LambdaFunctionProps {
15
18
  bucketName?: string;
16
19
  access?: "ReadOnly" | "ReadWrite" | "Full";
20
+ trigger?: {
21
+ events?: string[];
22
+ prefix?: string;
23
+ suffix?: string;
24
+ };
17
25
  defaults?: LambdaFunctionProps["defaults"] & {
18
26
  bucket?: Partial<ConstructorParameters<typeof Bucket>[0]>;
19
27
  };
20
28
  }
21
29
 
22
30
  export const LambdaS3 = Composite<LambdaS3Props>((props) => {
23
- const encryptionDefault = new Bucket_ServerSideEncryptionByDefault({
24
- SSEAlgorithm: "AES256",
25
- });
26
-
31
+ const encryptionDefault = new Bucket_ServerSideEncryptionByDefault({ SSEAlgorithm: "AES256" });
27
32
  const encryptionRule = new Bucket_ServerSideEncryptionRule({
28
33
  ServerSideEncryptionByDefault: encryptionDefault,
29
34
  });
30
-
31
35
  const bucketEncryption = new Bucket_BucketEncryption({
32
36
  ServerSideEncryptionConfiguration: [encryptionRule],
33
37
  });
34
-
35
38
  const publicAccessBlock = new Bucket_PublicAccessBlockConfiguration({
36
39
  BlockPublicAcls: true,
37
40
  BlockPublicPolicy: true,
@@ -40,30 +43,73 @@ export const LambdaS3 = Composite<LambdaS3Props>((props) => {
40
43
  });
41
44
 
42
45
  const { defaults } = props;
46
+ const access = props.access ?? "ReadWrite";
47
+
48
+ if (props.trigger) {
49
+ // Create Lambda first to break the circular CFN dependency.
50
+ // Compute bucket ARN from name (no GetAtt on bucket → no resource dep).
51
+ const name = props.bucketName ?? Sub`\${AWS::StackName}-bucket`;
52
+ const bucketArnBase = Join("", ["arn:aws:s3:::", name]);
53
+ const bucketArnWildcard = Join("", ["arn:aws:s3:::", name, "/*"]);
54
+
55
+ const s3Policy = new Role_Policy({
56
+ PolicyName: `S3${access}`,
57
+ PolicyDocument: {
58
+ Version: "2012-10-17",
59
+ Statement: [{ Effect: "Allow", Action: S3Actions[access], Resource: [bucketArnBase, bucketArnWildcard] }],
60
+ },
61
+ });
62
+
63
+ const policies = props.Policies ? [s3Policy, ...props.Policies] : [s3Policy];
64
+ const env = props.Environment ?? { Variables: {} };
65
+ const variables = { ...((env as any).Variables ?? {}), BUCKET_NAME: name };
66
+ const { role, func } = LambdaFunction({ ...props, Policies: policies, Environment: { Variables: variables } });
43
67
 
68
+ const permission = new Permission({
69
+ FunctionName: func.Arn,
70
+ Action: "lambda:InvokeFunction",
71
+ Principal: "s3.amazonaws.com",
72
+ SourceArn: bucketArnBase,
73
+ });
74
+
75
+ const { events = ["s3:ObjectCreated:*"], prefix, suffix } = props.trigger;
76
+ const rules: Array<{ Name: string; Value: string }> = [];
77
+ if (prefix) rules.push({ Name: "prefix", Value: prefix });
78
+ if (suffix) rules.push({ Name: "suffix", Value: suffix });
79
+
80
+ const lambdaConfigs = events.map((event) => new Bucket_LambdaConfiguration({
81
+ Event: event,
82
+ Function: func.Arn,
83
+ ...(rules.length > 0 && { Filter: { S3Key: { Rules: rules } } }),
84
+ }));
85
+
86
+ const notificationConfig = new Bucket_NotificationConfiguration({
87
+ LambdaConfigurations: lambdaConfigs,
88
+ });
89
+
90
+ const bucket = new Bucket(mergeDefaults({
91
+ BucketName: props.bucketName,
92
+ BucketEncryption: bucketEncryption,
93
+ PublicAccessBlockConfiguration: publicAccessBlock,
94
+ NotificationConfiguration: notificationConfig,
95
+ }, defaults?.bucket), { DependsOn: [permission] });
96
+
97
+ return { bucket, role, func, permission };
98
+ }
99
+
100
+ // Non-trigger path: original flow
44
101
  const bucket = new Bucket(mergeDefaults({
45
102
  BucketName: props.bucketName,
46
103
  BucketEncryption: bucketEncryption,
47
104
  PublicAccessBlockConfiguration: publicAccessBlock,
48
105
  }, defaults?.bucket));
49
106
 
50
- const access = props.access ?? "ReadWrite";
51
107
  const s3PolicyDocument = {
52
108
  Version: "2012-10-17",
53
- Statement: [
54
- {
55
- Effect: "Allow",
56
- Action: S3Actions[access],
57
- Resource: [bucket.Arn, Sub`${bucket.Arn}/*`],
58
- },
59
- ],
109
+ Statement: [{ Effect: "Allow", Action: S3Actions[access], Resource: [bucket.Arn, Sub`${bucket.Arn}/*`] }],
60
110
  };
61
111
 
62
- const s3Policy = new Role_Policy({
63
- PolicyName: `S3${access}`,
64
- PolicyDocument: s3PolicyDocument,
65
- });
66
-
112
+ const s3Policy = new Role_Policy({ PolicyName: `S3${access}`, PolicyDocument: s3PolicyDocument });
67
113
  const policies = props.Policies ? [s3Policy, ...props.Policies] : [s3Policy];
68
114
  const env = props.Environment ?? { Variables: {} };
69
115
  const variables = { ...((env as any).Variables ?? {}), BUCKET_NAME: bucket.Ref };
@@ -19787,6 +19787,7 @@ export declare class Logging {
19787
19787
  export declare class LogGroup {
19788
19788
  constructor(props: {
19789
19789
  Arn?: string;
19790
+ BearerTokenAuthenticationEnabled?: boolean;
19790
19791
  /** Creates a data protection policy and assigns it to the log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data. When a user who does not have permission to view masked data views a log event that includes masked data, the sensitive data is replaced by asterisks. */
19791
19792
  DataProtectionPolicy?: Record<string, unknown>;
19792
19793
  /** Indicates whether deletion protection is enabled for this log group. When enabled, deletion protection blocks all deletion operations until it is explicitly disabled. */
@@ -20555,6 +20556,7 @@ export declare class MediaLiveChannel {
20555
20556
  DryRun?: boolean;
20556
20557
  EncoderSettings?: MediaLiveChannel_EncoderSettings;
20557
20558
  Id?: string;
20559
+ InferenceSettings?: MediaLiveChannel_InferenceSettings;
20558
20560
  InputAttachments?: MediaLiveChannel_InputAttachment[];
20559
20561
  Inputs?: string[];
20560
20562
  InputSpecification?: MediaLiveChannel_InputSpecification;
@@ -30982,6 +30984,19 @@ export declare class SpotFleet {
30982
30984
  readonly Id: string;
30983
30985
  }
30984
30986
 
30987
+ export declare class SqlHaStandbyDetectedInstance {
30988
+ constructor(props: {
30989
+ InstanceId: string;
30990
+ HaStatus?: SqlHaStandbyDetectedInstance_HaStatus;
30991
+ LastUpdatedTime?: string;
30992
+ SqlServerCredentials?: string;
30993
+ SqlServerLicenseUsage?: SqlHaStandbyDetectedInstance_SqlServerLicenseUsage;
30994
+ }, attributes?: CFResourceAttributes);
30995
+ readonly HaStatus: SqlHaStandbyDetectedInstance_HaStatus;
30996
+ readonly LastUpdatedTime: string;
30997
+ readonly SqlServerLicenseUsage: SqlHaStandbyDetectedInstance_SqlServerLicenseUsage;
30998
+ }
30999
+
30985
31000
  export declare class SSMAssociation {
30986
31001
  constructor(props: {
30987
31002
  /** The name of the SSM document. */
@@ -90421,6 +90436,12 @@ export declare class InferenceScheduler_Tag {
90421
90436
  });
90422
90437
  }
90423
90438
 
90439
+ export declare class InferenceSettings {
90440
+ constructor(props: {
90441
+ FeedArn?: string;
90442
+ });
90443
+ }
90444
+
90424
90445
  export declare class InfluxDBCluster_Tag {
90425
90446
  constructor(props: {
90426
90447
  /** The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. */
@@ -103104,6 +103125,12 @@ export declare class MediaLiveChannel_HlsWebdavSettings {
103104
103125
  });
103105
103126
  }
103106
103127
 
103128
+ export declare class MediaLiveChannel_InferenceSettings {
103129
+ constructor(props: {
103130
+ FeedArn?: string;
103131
+ });
103132
+ }
103133
+
103107
103134
  export declare class MediaLiveChannel_InputAttachment {
103108
103135
  constructor(props: {
103109
103136
  AutomaticInputFailoverSettings?: MediaLiveChannel_AutomaticInputFailoverSettings;
@@ -163061,6 +163088,14 @@ export type Space_RemoteAccess = "DISABLED" | "ENABLED";
163061
163088
 
163062
163089
  export type Space_SpaceManagedResources = "DISABLED" | "ENABLED";
163063
163090
 
163091
+ export type SqlHaStandbyDetectedInstance_HaStatus =
163092
+ | "active"
163093
+ | "invalid"
163094
+ | "processing"
163095
+ | "standby";
163096
+
163097
+ export type SqlHaStandbyDetectedInstance_SqlServerLicenseUsage = "full" | "waived";
163098
+
163064
163099
  export type StackSet_Capability =
163065
163100
  | "CAPABILITY_AUTO_EXPAND"
163066
163101
  | "CAPABILITY_IAM"
@@ -1307,6 +1307,7 @@ export const SourceCredential = createResource("AWS::CodeBuild::SourceCredential
1307
1307
  export const SourceLocation = createResource("AWS::MediaTailor::SourceLocation", "aws", {"Arn":"Arn"});
1308
1308
  export const Space = createResource("AWS::SageMaker::Space", "aws", {"SpaceArn":"SpaceArn","Url":"Url"});
1309
1309
  export const SpotFleet = createResource("AWS::EC2::SpotFleet", "aws", {"Id":"Id"});
1310
+ export const SqlHaStandbyDetectedInstance = createResource("AWS::EC2::SqlHaStandbyDetectedInstance", "aws", {"HaStatus":"HaStatus","SqlServerLicenseUsage":"SqlServerLicenseUsage","LastUpdatedTime":"LastUpdatedTime"});
1310
1311
  export const SSMAssociation = createResource("AWS::SSM::Association", "aws", {"AssociationId":"AssociationId"});
1311
1312
  export const SSMContactsPlan = createResource("AWS::SSMContacts::Plan", "aws", {"Arn":"Arn"});
1312
1313
  export const SsmParameter = createResource("AWS::SSM::Parameter", "aws", {});
@@ -7424,6 +7425,7 @@ export const InferenceScheduler_InputNameConfiguration = createProperty("AWS::Lo
7424
7425
  export const InferenceScheduler_S3InputConfiguration = createProperty("AWS::LookoutEquipment::InferenceScheduler.S3InputConfiguration", "aws");
7425
7426
  export const InferenceScheduler_S3OutputConfiguration = createProperty("AWS::LookoutEquipment::InferenceScheduler.S3OutputConfiguration", "aws");
7426
7427
  export const InferenceScheduler_Tag = createProperty("AWS::LookoutEquipment::InferenceScheduler.Tag", "aws");
7428
+ export const InferenceSettings = createProperty("AWS::MediaLive::Channel.InferenceSettings", "aws");
7427
7429
  export const InfluxDBCluster_Tag = createProperty("AWS::Timestream::InfluxDBCluster.Tag", "aws");
7428
7430
  export const InfluxDBInstance_Tag = createProperty("AWS::Timestream::InfluxDBInstance.Tag", "aws");
7429
7431
  export const InforNexusConnectorProfileCredentials = createProperty("AWS::AppFlow::ConnectorProfile.InforNexusConnectorProfileCredentials", "aws");
@@ -8734,6 +8736,7 @@ export const MediaLiveChannel_HlsOutputSettings = createProperty("AWS::MediaLive
8734
8736
  export const MediaLiveChannel_HlsS3Settings = createProperty("AWS::MediaLive::Channel.HlsS3Settings", "aws");
8735
8737
  export const MediaLiveChannel_HlsSettings = createProperty("AWS::MediaLive::Channel.HlsSettings", "aws");
8736
8738
  export const MediaLiveChannel_HlsWebdavSettings = createProperty("AWS::MediaLive::Channel.HlsWebdavSettings", "aws");
8739
+ export const MediaLiveChannel_InferenceSettings = createProperty("AWS::MediaLive::Channel.InferenceSettings", "aws");
8737
8740
  export const MediaLiveChannel_InputAttachment = createProperty("AWS::MediaLive::Channel.InputAttachment", "aws");
8738
8741
  export const MediaLiveChannel_InputChannelLevel = createProperty("AWS::MediaLive::Channel.InputChannelLevel", "aws");
8739
8742
  export const MediaLiveChannel_InputLocation = createProperty("AWS::MediaLive::Channel.InputLocation", "aws");
@@ -55076,6 +55076,11 @@
55076
55076
  "kind": "property",
55077
55077
  "lexicon": "aws"
55078
55078
  },
55079
+ "InferenceSettings": {
55080
+ "resourceType": "AWS::MediaLive::Channel.InferenceSettings",
55081
+ "kind": "property",
55082
+ "lexicon": "aws"
55083
+ },
55079
55084
  "InfluxDBCluster": {
55080
55085
  "resourceType": "AWS::Timestream::InfluxDBCluster",
55081
55086
  "kind": "resource",
@@ -64675,6 +64680,9 @@
64675
64680
  },
64676
64681
  "DeletionProtectionEnabled": {
64677
64682
  "default": false
64683
+ },
64684
+ "BearerTokenAuthenticationEnabled": {
64685
+ "default": false
64678
64686
  }
64679
64687
  },
64680
64688
  "createOnly": [
@@ -68034,6 +68042,11 @@
68034
68042
  "kind": "property",
68035
68043
  "lexicon": "aws"
68036
68044
  },
68045
+ "MediaLiveChannel_InferenceSettings": {
68046
+ "resourceType": "AWS::MediaLive::Channel.InferenceSettings",
68047
+ "kind": "property",
68048
+ "lexicon": "aws"
68049
+ },
68037
68050
  "MediaLiveChannel_InputAttachment": {
68038
68051
  "resourceType": "AWS::MediaLive::Channel.InputAttachment",
68039
68052
  "kind": "property",
@@ -106409,6 +106422,22 @@
106409
106422
  "kind": "property",
106410
106423
  "lexicon": "aws"
106411
106424
  },
106425
+ "SqlHaStandbyDetectedInstance": {
106426
+ "resourceType": "AWS::EC2::SqlHaStandbyDetectedInstance",
106427
+ "kind": "resource",
106428
+ "lexicon": "aws",
106429
+ "attrs": {
106430
+ "HaStatus": "HaStatus",
106431
+ "SqlServerLicenseUsage": "SqlServerLicenseUsage",
106432
+ "LastUpdatedTime": "LastUpdatedTime"
106433
+ },
106434
+ "createOnly": [
106435
+ "InstanceId"
106436
+ ],
106437
+ "primaryIdentifier": [
106438
+ "InstanceId"
106439
+ ]
106440
+ },
106412
106441
  "SqlKnowledgeBaseConfiguration": {
106413
106442
  "resourceType": "AWS::Bedrock::KnowledgeBase.SqlKnowledgeBaseConfiguration",
106414
106443
  "kind": "property",
package/src/index.ts CHANGED
@@ -78,11 +78,13 @@ export {
78
78
  LambdaScheduled, ScheduledLambda,
79
79
  LambdaSqs, LambdaEventBridge, LambdaDynamoDB, LambdaS3, LambdaSns,
80
80
  VpcDefault, FargateAlb, AlbShared, FargateService, RdsInstance, RdsPostgres,
81
+ EfsWithAccessPoint,
81
82
  } from "./composites/index";
82
83
  export type {
83
84
  LambdaFunctionProps, LambdaApiProps, ScheduledLambdaProps,
84
85
  LambdaSqsProps, LambdaEventBridgeProps, LambdaDynamoDBProps, LambdaS3Props, LambdaSnsProps,
85
86
  VpcDefaultProps, FargateAlbProps, AlbSharedProps, FargateServiceProps, RdsInstanceProps, RdsPostgresProps,
87
+ EfsWithAccessPointProps,
86
88
  } from "./composites/index";
87
89
 
88
90
  // Code generation pipeline
package/src/serializer.ts CHANGED
@@ -303,9 +303,7 @@ function serializeToTemplate(
303
303
  template.Outputs = template.Outputs ?? {};
304
304
  for (const output of outputs) {
305
305
  template.Outputs[output.outputName] = {
306
- Value: {
307
- "Fn::GetAtt": [output.sourceEntity, output.sourceAttribute],
308
- },
306
+ Value: output.getOutputValue(),
309
307
  };
310
308
  }
311
309
  }