diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets.json new file mode 100644 index 0000000000000..312c8df9e9546 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "35.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.assets.json new file mode 100644 index 0000000000000..7298a7071a8c7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.assets.json @@ -0,0 +1,19 @@ +{ + "version": "35.0.0", + "files": { + "5c2f07ebfbfcbd172b157f7a34a21379fa004d47eda6f65b2f844a75938c0ac9": { + "source": { + "path": "aws-cdk-dedicated-ip-pool.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5c2f07ebfbfcbd172b157f7a34a21379fa004d47eda6f65b2f844a75938c0ac9.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.template.json new file mode 100644 index 0000000000000..34d36dc36df00 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/aws-cdk-dedicated-ip-pool.template.json @@ -0,0 +1,45 @@ +{ + "Resources": { + "PoolD3F588B8": { + "Type": "AWS::SES::DedicatedIpPool", + "Properties": { + "PoolName": "my-pool", + "ScalingMode": "MANAGED" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c5cb2e5de6344 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"35.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/integ.json new file mode 100644 index 0000000000000..fdc5bb3a7c5ca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "35.0.0", + "testCases": { + "DedicatedIpPoolInteg/DefaultTest": { + "stacks": [ + "aws-cdk-dedicated-ip-pool" + ], + "assertionStack": "DedicatedIpPoolInteg/DefaultTest/DeployAssert", + "assertionStackName": "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/manifest.json new file mode 100644 index 0000000000000..1e49a4718e366 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/manifest.json @@ -0,0 +1,113 @@ +{ + "version": "35.0.0", + "artifacts": { + "aws-cdk-dedicated-ip-pool.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-dedicated-ip-pool.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-dedicated-ip-pool": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-dedicated-ip-pool.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5c2f07ebfbfcbd172b157f7a34a21379fa004d47eda6f65b2f844a75938c0ac9.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-dedicated-ip-pool.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-dedicated-ip-pool.assets" + ], + "metadata": { + "/aws-cdk-dedicated-ip-pool/Pool/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PoolD3F588B8" + } + ], + "/aws-cdk-dedicated-ip-pool/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-dedicated-ip-pool/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-dedicated-ip-pool" + }, + "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "DedicatedIpPoolIntegDefaultTestDeployAssert1E9B4C6C.assets" + ], + "metadata": { + "/DedicatedIpPoolInteg/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/DedicatedIpPoolInteg/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "DedicatedIpPoolInteg/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/tree.json new file mode 100644 index 0000000000000..3943d94e453d2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.js.snapshot/tree.json @@ -0,0 +1,126 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-dedicated-ip-pool": { + "id": "aws-cdk-dedicated-ip-pool", + "path": "aws-cdk-dedicated-ip-pool", + "children": { + "Pool": { + "id": "Pool", + "path": "aws-cdk-dedicated-ip-pool/Pool", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-dedicated-ip-pool/Pool/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SES::DedicatedIpPool", + "aws:cdk:cloudformation:props": { + "poolName": "my-pool", + "scalingMode": "MANAGED" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ses.CfnDedicatedIpPool", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ses.DedicatedIpPool", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-dedicated-ip-pool/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-dedicated-ip-pool/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "DedicatedIpPoolInteg": { + "id": "DedicatedIpPoolInteg", + "path": "DedicatedIpPoolInteg", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "DedicatedIpPoolInteg/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "DedicatedIpPoolInteg/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "DedicatedIpPoolInteg/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "DedicatedIpPoolInteg/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "DedicatedIpPoolInteg/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.ts new file mode 100644 index 0000000000000..c6eb8ae4a3bcf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.dedicated-ip-pool.ts @@ -0,0 +1,17 @@ +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ses from 'aws-cdk-lib/aws-ses'; + +const app = new App(); +const stack = new Stack(app, 'aws-cdk-dedicated-ip-pool'); + +new ses.DedicatedIpPool(stack, 'Pool', { + dedicatedIpPoolName: 'my-pool', + scalingMode: ses.ScalingMode.MANAGED, +}); + +new integ.IntegTest(app, 'DedicatedIpPoolInteg', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-ses/README.md b/packages/aws-cdk-lib/aws-ses/README.md index 1b94d95346143..876b8a23edb24 100644 --- a/packages/aws-cdk-lib/aws-ses/README.md +++ b/packages/aws-cdk-lib/aws-ses/README.md @@ -114,7 +114,9 @@ dedicated IP addresses that are reserved for your exclusive use. Use the `DedicatedIpPool` construct to create a pool of dedicated IP addresses: ```ts -new ses.DedicatedIpPool(this, 'Pool'); +new ses.DedicatedIpPool(this, 'Pool', { + scalingMode: ses.ScalingMode.STANDARD, +}); ``` The pool can then be used in a configuration set. diff --git a/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts b/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts index 67f83475f08e1..42ff4a5f481b3 100644 --- a/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts @@ -2,6 +2,23 @@ import { Construct } from 'constructs'; import { CfnDedicatedIpPool } from './ses.generated'; import { IResource, Resource } from '../../core'; +/** + * Scaling mode to use for this IP pool. + * + * @see https://docs.aws.amazon.com/ses/latest/dg/dedicated-ip.html + */ +export enum ScalingMode { + /** + * The customer controls which IPs are part of the dedicated IP pool. + */ + STANDARD = 'STANDARD', + + /** + * The reputation and number of IPs are automatically managed by Amazon SES. + */ + MANAGED = 'MANAGED', +} + /** * A dedicated IP pool */ @@ -19,11 +36,21 @@ export interface IDedicatedIpPool extends IResource { */ export interface DedicatedIpPoolProps { /** - * A name for the dedicated IP pool + * A name for the dedicated IP pool. * * @default - a CloudFormation generated name */ readonly dedicatedIpPoolName?: string; + + /** + * The type of scailing mode to use for this IP pool + * + * Updating ScalingMode doesn't require a replacement if you're updating its value from `STANDARD` to `MANAGED`. + * However, updating ScalingMode from `MANAGED` to `STANDARD` is not supported. + * + * @default ScalingMode.STANDARD + */ + readonly scalingMode?: ScalingMode; } /** @@ -49,6 +76,7 @@ export class DedicatedIpPool extends Resource implements IDedicatedIpPool { const pool = new CfnDedicatedIpPool(this, 'Resource', { poolName: this.physicalName, + scalingMode: props.scalingMode, }); this.dedicatedIpPoolName = pool.ref; diff --git a/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts b/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts index ad5ef2d2e9d5b..82f83ba259ef2 100644 --- a/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts @@ -1,6 +1,6 @@ import { Template, Match } from '../../assertions'; import { Stack } from '../../core'; -import { DedicatedIpPool } from '../lib'; +import { DedicatedIpPool, ScalingMode } from '../lib'; let stack: Stack; beforeEach(() => { @@ -15,3 +15,15 @@ test('default dedicated IP pool', () => { PoolName: Match.absent(), }); }); + +test('dedicated IP pool with scailingMode', () => { + // GIVEN + new DedicatedIpPool(stack, 'Pool', { + scalingMode: ScalingMode.MANAGED, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SES::DedicatedIpPool', { + PoolName: Match.absent(), + ScalingMode: 'MANAGED', + }); +}); \ No newline at end of file