Skip to content

Commit

Permalink
Update to version v1.3.0
Browse files Browse the repository at this point in the history
## Added
- Service Catalog AppRegistry resource to register the CloudFormation template and underlying resources as an application in both Service Catalog AppRegistry and AWS Systems Manager Application Manager

## Changed
- Upgraded CDK version to 2.44.0
  • Loading branch information
tabdunabi authored Nov 17, 2022
2 parents 3f6f1b0 + 179d5c1 commit f6c2324
Show file tree
Hide file tree
Showing 125 changed files with 965 additions and 1,400 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ __pycache__/
**/venv*
**/.venv*
.python-version
pyvenv.cfg

## Python Testing
**/.pytest_cache
Expand Down Expand Up @@ -62,4 +63,4 @@ source/scheduler/cdk/aws_solutions/scheduler/cdk/aws_lambda/get_next_scheduled_e
source/cdk_solution_helper_py/helpers_cdk/build/*
source/cdk_solution_helper_py/helpers_common/build/*
source/scheduler/common/build/*
source/scheduler/cdk/build/*
source/scheduler/cdk/build/*
39 changes: 30 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[1.3.0] - 2022-11-17

### Added

[Service Catalog AppRegistry](https://docs.aws.amazon.com/servicecatalog/latest/arguide/intro-app-registry.html) resource to register the CloudFormation template and underlying resources as an application in both Service Catalog AppRegistry and AWS Systems Manager Application Manager

### Changed

- Upgraded CDK version to 2.44.0

## [1.2.0] - 2022-01-31

### Added
- The solution now supports batch segment jobs to get user segments with your solution version. Each user segment is
sorted in descending order based on the probability that each user will interact with items in your inventory.
- The solution now supports domain dataset groups.

### Changed
- The solution now supports batch segment jobs to get user segments with your solution version. Each user segment is
sorted in descending order based on the probability that each user will interact with items in your inventory.
- The solution now supports domain dataset groups.

### Changed

- Upgraded to CDKv2.

## [1.1.0] - 2021-11-22

### Added

- The solution now creates an Amazon EventBridge event bus, and puts messages to the bus when resources have been
created by the workflow. This can be useful when integrating with external systems.
created by the workflow. This can be useful when integrating with external systems.
- The solution now contains a command line interface (CLI) that allows schedule creation for existing resources in
Amazon Personalize.
Amazon Personalize.

## [1.0.1] - 2021-10-01

### Added

- The solution now exports the Amazon SNS Topic ARN as `SNSTopicArn`.

### Changed
### Changed

- The SNS message format will change based on the protocol used. For Amazon SQS and Email-JSON endpoints, a JSON payload
will be sent. The message sent to subscribed Email endpoints is unchanged.
will be sent. The message sent to subscribed Email endpoints is unchanged.
- The Amazon CloudWatch dashboard deployed by the solution will be replaced with a dashboard containing the stack's
region name.
region name.

## [1.0.0] - 2021-09-23

### Added

- All files, initial version
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ batch/
└── job_config.json.out
```

Note: It is not recommended to use `performAutoML` as this feature will be deprecated in the future. Please take the time to select the most appropriate recipe for the use-case and skip this feature. Refer [FAQs](https://github.com/aws-samples/amazon-personalize-samples/blob/master/PersonalizeCheatSheet2.0.md).

## Creating a custom build
To customize the solution, follow the steps below:

Expand All @@ -293,8 +295,8 @@ The following procedures assumes that all the OS-level configuration has been co
* [AWS Command Line Interface](https://aws.amazon.com/cli/)
* [Python](https://www.python.org/) 3.9 or newer
* [Node.js](https://nodejs.org/en/) 16.x or newer
* [AWS CDK](https://aws.amazon.com/cdk/) 2.7.0 or newer
* [Amazon Corretto OpenJDK](https://docs.aws.amazon.com/corretto/) 11
* [AWS CDK](https://aws.amazon.com/cdk/) 2.44.0 or newer
* [Amazon Corretto OpenJDK](https://docs.aws.amazon.com/corretto/) 17.0.4.1

> **Please ensure you test the templates before updating any production deployments.**
Expand Down Expand Up @@ -350,12 +352,12 @@ export VERSION=my-version
export REGION_NAME=my-region

build-s3-cdk-dist deploy \
--source-bucket-name DIST_BUCKET_PREFIX \
--solution-name SOLUTION_NAME \
--version_code VERSION \
--source-bucket-name $DIST_BUCKET_PREFIX \
--solution-name $SOLUTION_NAME \
--version_code $VERSION \
--cdk-app-path ../source/infrastructure/deploy.py \
--cdk-app-entrypoint deploy:build_app \
--region REGION_NAME \
--region $REGION_NAME \
--sync
```

Expand Down
16 changes: 4 additions & 12 deletions source/aws_lambda/s3_event/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def lambda_handler(event, context):

for record in event.records:
key = record.s3.get_object.key
logger.info(
f"processing Amazon S3 event notification record for s3://{bucket}/{key}"
)
logger.info(f"processing Amazon S3 event notification record for s3://{bucket}/{key}")
metrics.add_metric("ConfigurationsProcessed", unit=MetricUnit.Count, value=1)

s3_config = s3.get_object(Bucket=bucket, Key=key)
Expand All @@ -115,22 +113,16 @@ def lambda_handler(event, context):
configuration.load(config_text)
if configuration.errors:
send_configuration_error(configuration)
metrics.add_metric(
"ConfigurationsProcessedFailures", unit=MetricUnit.Count, value=1
)
metrics.add_metric("ConfigurationsProcessedFailures", unit=MetricUnit.Count, value=1)
return

# configuration has loaded, validate it
configuration.validate()
if configuration.errors:
metrics.add_metric(
"ConfigurationsProcessedFailures", unit=MetricUnit.Count, value=1
)
metrics.add_metric("ConfigurationsProcessedFailures", unit=MetricUnit.Count, value=1)
send_configuration_error(configuration)
else:
config = configuration.config_dict
config = set_bucket(config, bucket, key)
metrics.add_metric(
"ConfigurationsProcessedSuccesses", unit=MetricUnit.Count, value=1
)
metrics.add_metric("ConfigurationsProcessedSuccesses", unit=MetricUnit.Count, value=1)
start_execution(config)
8 changes: 2 additions & 6 deletions source/aws_lambda/shared/date_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@

def parse_datetime(tm: str) -> int:
if "month" in tm:
logger.warning(
"while months are supported, they are based off of the calendar of the start of year 1 CE"
)
logger.warning("while months are supported, they are based off of the calendar of the start of year 1 CE")
if "year" in tm:
logger.warning(
"while years are supported, they are based off of the calendar of the start of year 1 CE"
)
logger.warning("while years are supported, they are based off of the calendar of the start of year 1 CE")

start_of_time = datetime.datetime.min
cal = pdt.Calendar(version=pdt.VERSION_CONTEXT_STYLE)
Expand Down
8 changes: 2 additions & 6 deletions source/aws_lambda/shared/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def wrapper(caller, resource: Resource, **kwargs):

return wrapper

def notify(
self, resource: Resource, result: Dict, cutoff: Optional[datetime]
) -> None:
def notify(self, resource: Resource, result: Dict, cutoff: Optional[datetime]) -> None:
"""
Notify each target in the NOTIFY_LIST
:param resource: the subject of the notification
Expand All @@ -73,6 +71,4 @@ def notify(
try:
notifier.notify(self.status, resource, result)
except NotificationError as exc:
logger.error(
f"notifier {notifier.name} failed: {str(exc)}"
) # log and continue through notifiers
logger.error(f"notifier {notifier.name} failed: {str(exc)}") # log and continue through notifiers
24 changes: 6 additions & 18 deletions source/aws_lambda/shared/notifiers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,11 @@ def notify(self, status: str, resource: Resource, result: Dict) -> None:
logger.debug(f"{resource.name.camel} status update ({status}) on {result}")

if self._is_create(resource, result):
logger.info(
f"notifier {self.name} starting for creation of {resource.name.camel}"
)
logger.info(f"notifier {self.name} starting for creation of {resource.name.camel}")
self.notify_create(status, resource, result)
self.notified = True
elif self._resource_stable(resource, result):
logger.info(
f"notifier {self.name} starting for completion of {resource.name.camel}"
)
logger.info(f"notifier {self.name} starting for completion of {resource.name.camel}")
self.notify_complete(status, resource, result)
self.notified = True

Expand Down Expand Up @@ -116,9 +112,7 @@ def _resource_stable(self, resource: Resource, result: Dict) -> bool:
last_updated = self.get_resource_last_updated(resource, result)
created = self.get_resource_created(resource, result)
status = self.get_resource_status(resource, result)
latest_campaign_update = self.get_resource_latest_campaign_update(
resource, result
)
latest_campaign_update = self.get_resource_latest_campaign_update(resource, result)

if not last_updated or not created:
logger.info(
Expand All @@ -136,9 +130,7 @@ def _resource_stable(self, resource: Resource, result: Dict) -> bool:
logger.info(f"{resource.name.camel} is updating, and not yet active")
return False
elif not self.cutoff:
logger.debug(
f"{resource.name.camel} has no cutoff specified for notification"
)
logger.debug(f"{resource.name.camel} has no cutoff specified for notification")
return False
elif last_updated <= self.cutoff:
logger.info(f"{resource.name.camel} does not require update at this time")
Expand All @@ -147,9 +139,7 @@ def _resource_stable(self, resource: Resource, result: Dict) -> bool:
logger.info(f"{resource.name.camel} is ready for notification")
return True

def get_resource_latest_campaign_update(
self, resource: Resource, result: Dict
) -> Dict:
def get_resource_latest_campaign_update(self, resource: Resource, result: Dict) -> Dict:
"""
Campaigns track their update status separately from the top-level status - return the update status
:param resource: the Campaign resource
Expand All @@ -165,9 +155,7 @@ def get_resource_created(self, resource: Resource, result: Dict) -> datetime:
:param result: the resource as returned from the SDK
:return: datetime
"""
return jmespath.search(
TIME_FMT.format(name=resource.name.camel, date="creationDateTime"), result
)
return jmespath.search(TIME_FMT.format(name=resource.name.camel, date="creationDateTime"), result)

def get_resource_last_updated(self, resource: Resource, result: Dict) -> datetime:
"""
Expand Down
8 changes: 2 additions & 6 deletions source/aws_lambda/shared/notifiers/notify_eventbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def notify_complete(self, status: str, resource: Resource, result: Dict) -> None
seconds = int((updated - created).total_seconds())
self._notify(status, arn, resource, duration=seconds)

def _notify(
self, status: str, arn: str, resource: Resource, duration: int = 0
) -> None:
def _notify(self, status: str, arn: str, resource: Resource, duration: int = 0) -> None:
"""
The EventBridge notification implementation
:param status: the resource status
Expand All @@ -93,6 +91,4 @@ def _notify(
)
if result["FailedEntryCount"] > 0:
for entry in result["Entries"]:
logger.error(
f"EventBridge failure ({entry['ErrorCode']}) {entry['ErrorMessage']}"
)
logger.error(f"EventBridge failure ({entry['ErrorCode']}) {entry['ErrorMessage']}")
Loading

0 comments on commit f6c2324

Please sign in to comment.