Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from aws-quickstart/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vsnyc authored Jun 28, 2021
2 parents 8d298d6 + 7f14cc2 commit 86084ea
Show file tree
Hide file tree
Showing 18 changed files with 313 additions and 445 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "submodules/quickstart-aws-vpc"]
path = submodules/quickstart-aws-vpc
url = https://github.com/aws-quickstart/quickstart-aws-vpc.git
branch = master
branch = main
[submodule "submodules/quickstart-linux-bastion"]
path = submodules/quickstart-linux-bastion
url = https://github.com/aws-quickstart/quickstart-linux-bastion.git
branch = master
branch = main
[submodule "submodules/quickstart-microsoft-rdgateway"]
path = submodules/quickstart-microsoft-rdgateway
url = https://github.com/aws-quickstart/quickstart-microsoft-rdgateway.git
branch = master
branch = main
48 changes: 48 additions & 0 deletions .taskcat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
project:
name: quickstart-examples
owner: [email protected]
package_lambda: false
shorten_stack_name: true
s3_regional_buckets: true
regions:
- ap-northeast-1
- ap-northeast-2
- ap-south-1
- ap-southeast-1
- ap-southeast-2
- ca-central-1
- eu-central-1
- eu-west-1
- eu-west-2
- sa-east-1
- us-east-1
- us-east-2
- us-west-1
- us-west-2
s3_bucket: ''
tests:
examples-main:
parameters:
AvailabilityZones: $[alfred_getaz_2]
BastionAMIOS: Amazon-Linux2-HVM
BastionInstanceType: t2.micro
KeyPairName: $[alfred_getkeypair]
OperatorEmail: [email protected]
PrivateSubnet1CIDR: 10.0.0.0/19
PrivateSubnet2CIDR: 10.0.32.0/19
PublicSubnet1CIDR: 10.0.128.0/20
PublicSubnet2CIDR: 10.0.144.0/20
QSS3BucketName: $[taskcat_autobucket]
QSS3BucketRegion: $[taskcat_current_region]
RemoteAccessCIDR: 10.0.0.0/16
S3BucketName: alfred-develop-examples-$[alfred_genuuid]
VPCCIDR: 10.0.0.0/16
WorkloadInstanceType: m4.xlarge
WorkloadNodesDesiredCapacity: '2'
WorkloadNodesMaxSize: '4'
WorkloadNodesMinSize: '2'
regions:
- eu-west-1
- eu-central-1
s3_bucket: ''
template: templates/workload-yaml-entrypoint-new-vpc.template.yaml
26 changes: 13 additions & 13 deletions ci/taskcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ tests:
json-master:
parameter_input: workload-master.json
regions:
- ap-northeast-1
- ap-northeast-2
- ap-south-1
- ap-southeast-1
- ap-southeast-2
- ca-central-1
# - ap-northeast-1
# - ap-northeast-2
# - ap-south-1
# - ap-southeast-1
# - ap-southeast-2
# - ca-central-1
- eu-central-1
template_file: workload-json-master.template
template_file: workload-yaml-entrypoint-new-vpc.template.yaml
yaml-master:
parameter_input: workload-master.json
regions:
- eu-west-1
- eu-west-2
- us-east-1
- us-east-2
- us-west-1
- us-west-2
template_file: workload-yaml-master.template
# - eu-west-2
# - us-east-1
# - us-east-2
# - us-west-1
# - us-west-2
template_file: workload-yaml-entrypoint-new-vpc.template.yaml
74 changes: 0 additions & 74 deletions ci/workload-master.json

This file was deleted.

12 changes: 6 additions & 6 deletions patterns/LambdaZips/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Resources:
Properties:
Description: Copies objects from a source S3 bucket to a destination
Handler: index.handler
Runtime: python2.7
Runtime: python3.7
Role: !GetAtt 'CopyZipsRole.Arn'
Timeout: 240
Code:
Expand All @@ -75,9 +75,9 @@ Resources:
'Bucket': source_bucket,
'Key': key
}
print('copy_source: %s' % copy_source)
print('dest_bucket = %s'%dest_bucket)
print('key = %s' %key)
print(('copy_source: %s' % copy_source))
print(('dest_bucket = %s'%dest_bucket))
print(('key = %s' %key))
s3.copy_object(CopySource=copy_source, Bucket=dest_bucket,
Key=key)
Expand All @@ -100,7 +100,7 @@ Resources:
/ 1000.00) - 0.5, timeout, args=[event, context])
timer.start()
print('Received event: %s' % json.dumps(event))
print(('Received event: %s' % json.dumps(event)))
status = cfnresponse.SUCCESS
try:
source_bucket = event['ResourceProperties']['SourceBucket']
Expand Down Expand Up @@ -136,7 +136,7 @@ Resources:
Properties:
Description: Example
Handler: lambda_function.handler
Runtime: python2.7
Runtime: python3.7
Role: !GetAtt 'MyFunctionRole.Arn'
Timeout: 300
Code:
Expand Down
2 changes: 1 addition & 1 deletion patterns/blog/CircularDependency/LessSimpleNonWorking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucketname/object.zip # Add in an S3 URI where you have code Lambda Code
Runtime: python2.7
Runtime: python3.7
Handler: index.handler
Policies:
- Version: 2012-10-17
Expand Down
2 changes: 1 addition & 1 deletion patterns/blog/CircularDependency/LessSimpleWorking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucketname/object.zip # Add in an S3 URI where you have code Lambda Code
Runtime: python2.7
Runtime: python3.7
Handler: index.handler
Policies:
- Version: 2012-10-17
Expand Down
12 changes: 6 additions & 6 deletions samples/cloudformation-codebuild-container/codebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Resources:
Properties:
Description: Copies objects from a source S3 bucket to a destination
Handler: index.handler
Runtime: python2.7
Runtime: python3.7
Role: !GetAtt 'CopyZipsRole.Arn'
Timeout: 240
Code:
Expand All @@ -73,9 +73,9 @@ Resources:
- ' ''Bucket'': source_bucket,'
- ' ''Key'': key'
- ' }'
- ' print(''copy_source: %s'' % copy_source)'
- ' print(''dest_bucket = %s''%dest_bucket)'
- ' print(''key = %s'' %key)'
- ' print((''copy_source: %s'' % copy_source))'
- ' print((''dest_bucket = %s''%dest_bucket))'
- ' print((''key = %s'' %key))'
- ' s3.copy_object(CopySource=copy_source, Bucket=dest_bucket,
Key=key)'
- ''
Expand All @@ -99,7 +99,7 @@ Resources:
/ 1000.00) - 0.5, timeout, args=[event, context])'
- ' timer.start()'
- ''
- ' print(''Received event: %s'' % json.dumps(event))'
- ' print((''Received event: %s'' % json.dumps(event)))'
- ' status = cfnresponse.SUCCESS'
- ' try:'
- ' source_bucket = event[''ResourceProperties''][''SourceBucket'']'
Expand Down Expand Up @@ -283,7 +283,7 @@ Resources:
S3Bucket: !Ref LambdaZipsBucket
S3Key: !Sub "quickstart-examples/samples/cloudformation-codebuild-container/${LambdaCodePath}"
Handler: "lambda_codebuild.lambda_handler"
Runtime: python2.7
Runtime: python3.7
Timeout: 300
Role: !GetAtt CodeBuildLambdaExecutionRole.Arn
CodeBuildLambdaExecutionRole:
Expand Down
20 changes: 10 additions & 10 deletions samples/cloudformation-codebuild-container/lambda_codebuild.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This AWS Lambda Function kicks off a code build job."""
import httplib
import urlparse
import http.client
import urllib.parse
import json
import boto3
import traceback
Expand All @@ -12,7 +12,7 @@ def lambda_handler(event, context):

try:
# Log the received event
print("Received event: " + json.dumps(event, indent=2))
print(("Received event: " + json.dumps(event, indent=2)))

# Setup base response
response = get_response_dict(event)
Expand All @@ -24,7 +24,7 @@ def lambda_handler(event, context):
execute_build(event)
except Exception as build_exce:
print("ERROR: Build threw exception")
print(repr(build_exce))
print((repr(build_exce)))
# Signal back that we failed
return send_response(event, get_response_dict(event),
"FAILED", repr(build_exce))
Expand All @@ -42,11 +42,11 @@ def lambda_handler(event, context):
cleanup_images_repo(repository, account_id)
except Exception as cleanup_exception:
# signal failure to CFN
print(json.dumps(event, indent=2))
print((json.dumps(event, indent=2)))
traceback.print_stack()
print("---------")
traceback.print_exc()
print(repr(cleanup_exception))
print((repr(cleanup_exception)))
return send_response(event, response, "FAILED",
"Cleanup of Container image failed." + repr(cleanup_exception))
# signal success to CFN
Expand All @@ -67,7 +67,7 @@ def cleanup_images_repo(repository, account_id):
"""
ecr_client = boto3.client('ecr')

print("Repo:" + repository + " AccountID:" + account_id)
print(("Repo:" + repository + " AccountID:" + account_id))
response = ecr_client.describe_images(
registryId=account_id,
repositoryName=repository
Expand Down Expand Up @@ -97,7 +97,7 @@ def execute_build(event):
stack_id = event["StackId"]
request_id = event["RequestId"]
logical_resource_id = event["LogicalResourceId"]
url = urlparse.urlparse(event['ResponseURL'])
url = urllib.parse.urlparse(event['ResponseURL'])
response = build.start_build(
projectName=project_name, environmentVariablesOverride=[
{'name': 'url_path', 'value': url.path},
Expand Down Expand Up @@ -130,9 +130,9 @@ def send_response(event, response, status=None, reason=None):
response['Reason'] = reason

if 'ResponseURL' in event and event['ResponseURL']:
url = urlparse.urlparse(event['ResponseURL'])
url = urllib.parse.urlparse(event['ResponseURL'])
body = json.dumps(response)
https = httplib.HTTPSConnection(url.hostname)
https = http.client.HTTPSConnection(url.hostname)
https.request('PUT', url.path+'?'+url.query, body)
print("Sent CFN Response")

Expand Down
Binary file modified samples/cloudformation-codebuild-container/lambda_codebuild.zip
100755 → 100644
Binary file not shown.
Loading

0 comments on commit 86084ea

Please sign in to comment.