Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions dev-resources/template/1_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ Parameters:
DBEngineVersion:
Description: PostgreSQL engine version on RDS
Type: String
Default: "14.3"
Default: "18.3"
AllowedValues:
- "12.9"
- "14.3"
- "16.13"
- "15.17"
- "17.9"
- "18.3"
DBInstanceClass:
Description: For provisioned aurora, the instance class to use
Type: String
Expand Down Expand Up @@ -76,10 +78,14 @@ Parameters:

Mappings:
DBClusterParameterGroupMap:
"12.9":
Name: default.aurora-postgresql12
"14.3":
Name: default.aurora-postgresql14
"15.17":
Name: default.aurora-postgresql15
"16.13":
Name: default.aurora-postgresql16
"17.9":
Name: default.aurora-postgresql17
"18.3":
Name: default.aurora-postgresql18

Conditions:
DBProvisioned:
Expand Down
62 changes: 44 additions & 18 deletions dev-resources/template/2_lrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Parameters:
DBInitFnVersion:
Type: String
Description: Version of rds-db-init function code to use to initialize the DB application user.
Default: "0.0.2"
Default: "0.0.3"
DBInitFnBucketOverride:
Type: String
Description: Override for the S3 bucket to source the DB Init function. Use this if you are hosting your own DB init function code.
Expand Down Expand Up @@ -81,7 +81,7 @@ Parameters:
LrsVersion:
Description: Version of SQL LRS to download and install (public release versions on GitHub)
Type: String
Default: v0.5.5
Default: v0.9.7

EnableReactions:
Description: Whether or not to enable xAPI Reactions
Expand Down Expand Up @@ -192,7 +192,7 @@ Resources:
- !Ref DBInitFnKeyOverride
- !Sub "rds-db-init-v${DBInitFnVersion}.zip"
Handler: index.handler
Runtime: nodejs16.x
Runtime: nodejs22.x
Timeout: 15
Role: !GetAtt DBInitFnExecRole.Arn
VpcConfig:
Expand Down Expand Up @@ -319,7 +319,7 @@ Resources:
random_str = ''.join(random.choices(string.ascii_letters + string.digits, k=63))
resp_value = {'random_string': random_str}
cfnresponse.send(event, context, cfnresponse.SUCCESS, resp_value)
Runtime: 'python3.8'
Runtime: 'python3.14'
Timeout: 10

# Run the lambda init fn as a custom resource
Expand Down Expand Up @@ -396,6 +396,7 @@ Resources:
- !Ref InstancePolicy
- !Ref LogPolicy
- arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
- arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore

InstanceProfile:
Type: AWS::IAM::InstanceProfile
Expand Down Expand Up @@ -441,17 +442,17 @@ Resources:
AWS::CloudFormation::Init:
configSets:
default:
- installLrs
- setupCfnHup
- configureCw
- restartCw
- installLrs
- setupCfnHup
- configureLrs
- enableLrs
- startLrs
UpdateEnvironment:
- installLrs
- configureCw
- restartCw
- installLrs
- configureLrs
- restartLrs
installLrs:
Expand All @@ -468,10 +469,10 @@ Resources:
commands:
00make_dir:
cwd: "~"
command: "sudo mkdir /opt/lrsql"
command: "sudo mkdir -p /opt/lrsql"
01unzip_lrs:
cwd: "~"
command: "sudo unzip /tmp/lrsql.zip -d /opt/lrsql/"
command: "sudo unzip -o /tmp/lrsql.zip -d /opt/lrsql/"
setupCfnHup:
files:
"/etc/cfn/cfn-hup.conf":
Expand Down Expand Up @@ -518,6 +519,9 @@ Resources:
'/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json':
content: !Sub |
{
"agent": {
"metrics_collection_interval": 60
},
"metrics": {
"append_dimensions": {
"AutoScalingGroupName": "${!aws:AutoScalingGroupName}",
Expand All @@ -532,7 +536,8 @@ Resources:
"usage_nice",
"usage_system",
"usage_user"
]
],
"totalcpu": true
},
"mem": {
"measurement": [
Expand All @@ -551,23 +556,44 @@ Resources:
"files":{
"collect_list": [
{
"file_path": "/opt/lrsql/logs/*",
"auto_removal": true,
"file_path": "/opt/lrsql/logs/lrsql*.log",
"log_group_name": "${LogGroup}",
"log_stream_name": "lrsql-instance-{instance_id}"
},
{
"file_path": "/var/log/cloud-init-output.log",
"log_group_name": "${LogGroup}",
"log_stream_name": "bootstrap/{instance_id}/cloud-init"
},
{
"file_path": "/var/log/cfn-init.log",
"log_group_name": "${LogGroup}",
"log_stream_name": "bootstrap/{instance_id}/cfn-init"
},
{
"file_path": "/var/log/cfn-hup.log",
"log_group_name": "${LogGroup}",
"log_stream_name": "bootstrap/{instance_id}/cfn-hup"
},
{
"file_path": "/var/log/messages",
"log_group_name": "${LogGroup}",
"log_stream_name": "system/{instance_id}/messages"
},
{
"file_path": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log",
"log_group_name": "${LogGroup}",
"log_stream_name": "bootstrap/{instance_id}/cloudwatch-agent"
}
]
}
},
"log_stream_name": "lrsql-instance-{instance_id}"
}
}
}
# Invoke amazon-cloudwatch-agent-ctl to restart the AmazonCloudWatchAgent.
# Validate the config and start (or restart) the CloudWatch agent.
restartCw:
commands:
01_stop_service:
command: /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a stop
02_start_service:
01_start_service:
command: /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json -s
configureLrs:
files:
Expand Down
Loading