Skip to content

Commit 6f86b91

Browse files
committed
Updated to v1.3
1 parent b61839c commit 6f86b91

File tree

667 files changed

+1294
-4388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+1294
-4388
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
3+
*.zip
4+
deployment/open-source
5+
deployment/dist
6+
source/deploy
7+
8+
.env
9+
source/code/sample_events
10+
.vscode
11+
__pycache__

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [0.0.1] - 2019-08-26
8+
### Added
9+
- Upgraded the Solution to Python 3.7

LICENSE.txt

Lines changed: 174 additions & 51 deletions
Large diffs are not rendered by default.

NOTICE.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
AWS Instance Scheduler V2
2-
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
3+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
Licensed under the Apache License Version 2.0 (the "License"). You may not use this file except
5+
in compliance with the License. A copy of the License is located at http://www.apache.org/licenses/
6+
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
7+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for the
8+
specific language governing permissions and limitations under the License.
9+
10+
**********************
11+
THIRD PARTY COMPONENTS
12+
**********************
13+
This software includes third party software subject to the following copyrights:
14+
15+
AWS SDK under the Apache License Version 2.0
16+
pytz under the Massachusetts Institute of Technology (MIT) license

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ Scheduler for Cross-Account and Cross-Region scheduling for EC2 and RDS instance
77
## Setup
88

99
Deploys from Cloudformation template generate by makefile
10+
Sample make command: `make bucket=solutions-test-reference solution=aws-instance-scheduler version=1.2.1`
1011

1112

1213
***
1314

14-
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
15+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1516

16-
Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
17+
Licensed under the Apache License Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
1718

18-
http://aws.amazon.com/asl/
19+
http://www.apache.org/licenses/
1920

2021
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and limitations under the License.

deployment/build-s3-dist.sh

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
#!/usr/bin/env bash
2-
echo "Staring to build distribution"
3-
echo "make build"
4-
echo "Pipeline type ${1}"
5-
export BUCKET_PREFIX=solutions
6-
if [ $1 = "mainline" ]; then
7-
export BUCKET_PREFIX=solutions-test
8-
fi
9-
if [ $1 = "feature" ]; then
10-
export BUCKET_PREFIX=solutions-features
1+
#!/bin/bash
2+
#
3+
# This assumes all of the OS-level configuration has been completed and git repo has already been cloned
4+
#
5+
# This script should be run from the repo's deployment directory
6+
# cd deployment
7+
# ./build-s3-dist.sh source-bucket-base-name trademarked-solution-name version-code
8+
#
9+
# Parameters:
10+
# - source-bucket-base-name: Name for the S3 bucket location where the template will source the Lambda
11+
# code from. The template will append '-[region_name]' to this bucket name.
12+
# For example: ./build-s3-dist.sh solutions my-solution v1.0.0
13+
# The template will then expect the source code to be located in the solutions-[region_name] bucket
14+
#
15+
# - trademarked-solution-name: name of the solution for consistency
16+
#
17+
# - version-code: version of the solution
18+
19+
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
20+
echo "Please provide the base source bucket name, trademark approved solution name and version where the lambda code will eventually reside."
21+
echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v1.0.0"
22+
exit 1
1123
fi
12-
echo ${VERSION} > ../source/code/version.txt
1324

14-
export OBJECT_PREFIX='aws-instance-scheduler/${VERSION}/'
15-
echo "Bucket prefix for distribution '${BUCKET_PREFIX}/${VERSION}'"
25+
echo "make bucket=$1 solution=$2 version=$3"
1626
cd ../source/code
17-
echo "make bucket=${BUCKET_PREFIX} prefix=${OBJECT_PREFIX}"
18-
make bucket=$BUCKET_PREFIX prefix="${OBJECT_PREFIX}"
27+
make bucket=$1 solution=$2 version=$3
1928
cd ../../deployment
20-
echo "mkdir -p dist"
21-
mkdir -p dist
22-
23-
mv instance-scheduler-latest.template dist/instance-scheduler.template
24-
mv instance-scheduler-remote-latest.template dist/instance-scheduler-remote.template
25-
mv scheduler-cli-latest.zip dist/scheduler-cli.zip
26-
mv instance-scheduler-`cat ../source/code/version.txt`.zip dist
27-
28-
rm instance-scheduler-`cat ../source/code/version.txt`.template
29-
rm instance-scheduler-remote-`cat ../source/code/version.txt`.template
30-
rm scheduler-cli-`cat ../source/code/version.txt`.zip
31-
32-
33-
echo "Completed building distribution"
29+
echo "Completed building distribution"

deployment/instance-scheduler-remote.template

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "(SO0030) - Instance scheduler cross account role, version %version%",
3+
"Description": "(SO0030) - %solution% cross account role, version %version%",
44
"Parameters": {
55
"InstanceSchedulerAccount": {
66
"Type": "String",
@@ -71,7 +71,11 @@
7171
"Statement": [
7272
{
7373
"Effect": "Allow",
74-
"Action": "rds:DeleteDBSnapshot",
74+
"Action": [
75+
"rds:DeleteDBSnapshot",
76+
"rds:DescribeDBSnapshots",
77+
"rds:StopDBInstance"
78+
],
7579
"Resource": {
7680
"Fn::Join": [
7781
":",
@@ -110,6 +114,8 @@
110114
{
111115
"Effect": "Allow",
112116
"Action": [
117+
"rds:AddTagsToResource",
118+
"rds:RemoveTagsFromResource",
113119
"rds:StartDBCluster",
114120
"rds:StopDBCluster"
115121
],
@@ -156,7 +162,6 @@
156162
"Action": [
157163
"rds:DescribeDBClusters",
158164
"rds:DescribeDBInstances",
159-
160165
"ec2:DescribeInstances",
161166
"ec2:DescribeRegions",
162167
"ec2:ModifyInstanceAttribute",

deployment/instance-scheduler.template

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "(SO0030) - Instance scheduler, version %version%",
3+
"Description": "(SO0030) - %solution%, version %version%",
44
"Parameters": {
55
"SchedulingActive": {
66
"Type": "String",
@@ -795,7 +795,7 @@
795795
"Ref": "AWS::AccountId"
796796
},
797797
"log-group",
798-
{
798+
{
799799
"Ref": "SchedulerLogGroup"
800800
},
801801
"*"
@@ -864,6 +864,8 @@
864864
{
865865
"Effect": "Allow",
866866
"Action": [
867+
"rds:AddTagsToResource",
868+
"rds:RemoveTagsFromResource",
867869
"rds:StartDBCluster",
868870
"rds:StopDBCluster"
869871
],
@@ -1030,7 +1032,6 @@
10301032
"ssm:DescribeMaintenanceWindows",
10311033

10321034
"tag:GetResources",
1033-
10341035
"sts:AssumeRole"
10351036
],
10361037
"Resource": [
@@ -1171,10 +1172,10 @@
11711172
]
11721173
]
11731174
},
1174-
"S3Key": "%prefix%instance-scheduler-%version%.zip"
1175+
"S3Key": "%solution%/%version%/instance-scheduler.zip"
11751176
},
11761177
"Handler": "main.lambda_handler",
1177-
"Runtime": "python2.7",
1178+
"Runtime": "python3.7",
11781179
"Role": {
11791180
"Fn::GetAtt": [
11801181
"SchedulerRole",

source/cloudformation/instance-scheduler-remote.template

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "(SO0030) - Instance scheduler cross account role, version %version%",
3+
"Description": "(SO0030) - %solution% cross account role, version %version%",
44
"Parameters": {
55
"InstanceSchedulerAccount": {
66
"Type": "String",
@@ -71,7 +71,11 @@
7171
"Statement": [
7272
{
7373
"Effect": "Allow",
74-
"Action": "rds:DeleteDBSnapshot",
74+
"Action": [
75+
"rds:DeleteDBSnapshot",
76+
"rds:DescribeDBSnapshots",
77+
"rds:StopDBInstance"
78+
],
7579
"Resource": {
7680
"Fn::Join": [
7781
":",
@@ -110,6 +114,8 @@
110114
{
111115
"Effect": "Allow",
112116
"Action": [
117+
"rds:AddTagsToResource",
118+
"rds:RemoveTagsFromResource",
113119
"rds:StartDBCluster",
114120
"rds:StopDBCluster"
115121
],
@@ -156,7 +162,6 @@
156162
"Action": [
157163
"rds:DescribeDBClusters",
158164
"rds:DescribeDBInstances",
159-
160165
"ec2:DescribeInstances",
161166
"ec2:DescribeRegions",
162167
"ec2:ModifyInstanceAttribute",

source/cloudformation/instance-scheduler.template

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "(SO0030) - Instance scheduler, version %version%",
3+
"Description": "(SO0030) - %solution%, version %version%",
44
"Parameters": {
55
"SchedulingActive": {
66
"Type": "String",
@@ -795,7 +795,7 @@
795795
"Ref": "AWS::AccountId"
796796
},
797797
"log-group",
798-
{
798+
{
799799
"Ref": "SchedulerLogGroup"
800800
},
801801
"*"
@@ -864,6 +864,8 @@
864864
{
865865
"Effect": "Allow",
866866
"Action": [
867+
"rds:AddTagsToResource",
868+
"rds:RemoveTagsFromResource",
867869
"rds:StartDBCluster",
868870
"rds:StopDBCluster"
869871
],
@@ -1030,7 +1032,6 @@
10301032
"ssm:DescribeMaintenanceWindows",
10311033

10321034
"tag:GetResources",
1033-
10341035
"sts:AssumeRole"
10351036
],
10361037
"Resource": [
@@ -1171,10 +1172,10 @@
11711172
]
11721173
]
11731174
},
1174-
"S3Key": "%prefix%instance-scheduler-%version%.zip"
1175+
"S3Key": "%solution%/%version%/instance-scheduler.zip"
11751176
},
11761177
"Handler": "main.lambda_handler",
1177-
"Runtime": "python2.7",
1178+
"Runtime": "python3.7",
11781179
"Role": {
11791180
"Fn::GetAtt": [
11801181
"SchedulerRole",

0 commit comments

Comments
 (0)