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

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
davmayd authored May 30, 2023
2 parents 6d1debe + 1d78d41 commit 1bdd2cf
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 33 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @aws-quickstart/aws_quickstart_team
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# quickstart-examples
# AWS Partner Solution examples

This GitHub repository contains example AWS Quick Start templates, including AWS CloudFormation, deployment guide, and diagram templates. It also includes examples that are discussed in the [Infrastructure & Automation blog](https://aws.amazon.com/blogs/infrastructure-and-automation/).
This GitHub repository contains example files for [AWS Partner Solutions](https://aws.amazon.com/solutions/browse-all/?solutions-all.sort-by=item.additionalFields.sortDate&solutions-all.sort-order=desc&awsf.Content-Type=*all&awsf.AWS-Product%20Category=*all), including AWS CloudFormation templates, deployment guides, and architecture diagrams. It also includes examples that are discussed in posts on the [Integration & Automation Blog](https://aws.amazon.com/blogs/infrastructure-and-automation/).
12 changes: 12 additions & 0 deletions blog-assets/change-cfn-stack-name/01-vpc-basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
AWSTemplateFormatVersion: 2010-09-09

Description: "Deploys a VPC (qs-1t72ibrq5)"

Resources:
Vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
Tags:
- Key: Name
Value: rename-stack-demo
13 changes: 13 additions & 0 deletions blog-assets/change-cfn-stack-name/02-vpc-retain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AWSTemplateFormatVersion: 2010-09-09

Description: Deploys a VPC

Resources:
Vpc:
Type: AWS::EC2::VPC
DeletionPolicy: Retain
Properties:
CidrBlock: 10.0.0.0/16
Tags:
- Key: Name
Value: rename-stack-demo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Parameters:
AccessCIDR:
Default: 0.0.0.0/0
Type: String
KeyPairName:
Description: Name of an existing key pair, which allows you to securely connect to your bastion instance after it launches.
Leave empty to proceed without a key pair. You would need to use AWS Systems Manager Session Manager to connect to the provisioned EC2 instances.
Type: String
Default: ""
JobName:
Type: String
Default: 'job-example'
Expand All @@ -21,16 +26,13 @@ Parameters:
Default: 'aws-quickstart'
PreworkScriptObject:
Type: String
Default: 'quickstart-examples/blog-assets/eks-cluster-prework/script/pw-script.sh'
Default: 'quickstart-examples/blog-assets/eks-cluster-prework/scripts/pw-script.sh'
Resources:
EKSStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: 'https://aws-quickstart.s3.amazonaws.com/quickstart-amazon-eks/templates/amazon-eks-entrypoint-new-vpc.template.yaml'
Parameters:
# QuickStart properties
QSS3BucketName: aws-quickstart
QSS3KeyPrefix: quickstart-amazon-eks/
# Cluster properties
ProvisionBastionHost: Enabled
RemoteAccessCIDR: !Ref AccessCIDR
Expand All @@ -45,20 +47,16 @@ Resources:
AwsCliCommand: !Sub "eks describe-cluster --name ${EKSStack.Outputs.EKSClusterName} --query 'cluster.identity.oidc.{issuer:issuer}'"
IdField: 'issuer'
PreworkStack:
DependsOn: EKSStack
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: 'https://aws-quickstart.s3.amazonaws.com/quickstart-examples/blog-assets/eks-cluster-prework/templates/prework.template.yaml'
Parameters:
ClusterName: !Sub "EKSStack.Outputs.EKSClusterName"
ClusterName: !GetAtt "EKSStack.Outputs.EKSClusterName"
PreworkScriptBucket: !Ref PreworkScriptBucket
PreworkScriptObject: !Ref PreworkScriptObject
JobName: !Ref JobName
KubernetesNameSpace: "prework-example"
OIDCProvider: !Sub
- "${OIDCProvider1}/${OIDCProvider2}/${OIDCProvider3}"
- OIDCProvider1: !Select [ 2, !Split [ "/", !Ref GetOIDCProvider ] ]
OIDCProvider2: !Select [ 3, !Split [ "/", !Ref GetOIDCProvider ] ]
OIDCProvider3: !Select [ 4, !Split [ "/", !Ref GetOIDCProvider ] ]
Outputs:
EKSClusterName:
Value: !GetAtt EKSStack.Outputs.EKSClusterName
Expand Down
22 changes: 12 additions & 10 deletions blog-assets/eks-cluster-prework/templates/prework.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ Parameters:
Default: aws-quickstart
PreworkScriptObject:
Type: String
Default: "quickstart-examples/samples/eks-cluster-prework/scripts/pw-script.sh"
Default: "quickstart-examples/blog-assets/eks-cluster-prework/scripts/pw-script.sh"
JobName:
Type: String
Default: job-example
Default: example-job
AllowedPattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
ConstraintDescription: "a lowercase RFC 1123 subdomain must consist of lower case
alphanumeric characters, '-' or '.', and must start and end with an alphanumeric
character"
OIDCProvider:
Type: String
Description: Amazon EKS cluster OIDC provider, without the protocol (e.g., oidc.eks.us-east-1.amazonaws.com/id/SADFASFFASFXCCVXCVSDFSDF).
Default: ""
KubernetesNameSpace:
Type: String
Default: "prework-example"
Expand Down Expand Up @@ -49,6 +45,7 @@ Resources:
}
- NameSpace: !Ref KubernetesNameSpace
ResourceName: !Sub "pw-service-account-${JobName}"
OIDCProvider: !Join [ '', !Split [ 'https://', !Ref 'GetOIDCProvider' ] ]
Path: "/"
Policies:
- PolicyName: root
Expand All @@ -60,7 +57,13 @@ Resources:
- s3:GetObject
- s3:HeadObject
Resource:
- !Sub "arn:aws:s3:::${PreworkScriptBucket}/${PreworkScriptObject}"
- !Sub "arn:${AWS::Partition}:s3:::${PreworkScriptBucket}/${PreworkScriptObject}"
GetOIDCProvider:
Type: Custom::GetOIDCProvider
Properties:
ServiceToken: !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:eks-quickstart-ResourceReader"
AwsCliCommand: !Sub "eks describe-cluster --name ${ClusterName} --query 'cluster.identity.oidc.{issuer:issuer}'"
IdField: 'issuer'
KubePreWorkNamespace:
Type: "AWSQS::Kubernetes::Resource"
Properties:
Expand Down Expand Up @@ -164,10 +167,9 @@ Resources:
args:
- >
sleep 15;
yum update -y;
yum install -y awscli;
export AWS_REGION=${AWS::Region};
export NS=${NameSpace};
yum install -y aws-cli;
aws sts get-caller-identity;
aws s3 cp ${!S3_SCRIPT_URL} ./prework-script.sh &&
chmod +x ./prework-script.sh &&
Expand All @@ -184,4 +186,4 @@ Resources:
backoffLimit: 4
- ResourceName: !Sub "pw-job-${JobName}"
NameSpace: !Ref "KubernetesNameSpace"
S3ScriptURL: !Sub "s3://${PreworkScriptBucket}/${PreworkScriptObject}"
S3ScriptURL: !Sub "s3://${PreworkScriptBucket}/${PreworkScriptObject}"
4 changes: 2 additions & 2 deletions blog-assets/svcvirt-apigateway-cfn/template.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: '2010-09-09'

Description: AWS API Gateway working as a Service Virtualization
Description: "AWS API Gateway working as a Service Virtualization (qs-1sq3s942d)"

Resources:

Expand Down Expand Up @@ -155,4 +155,4 @@ Resources:
- PostMethod
Properties:
Description: Mock API Deployment
RestApiId: !Ref RestApi
RestApiId: !Ref RestApi
Binary file not shown.
Binary file removed doc/Quick Start architecture diagram.pptx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import string
import logging
import threading
from botocore.vendored import requests
import requests
import json
from botocore.credentials import (
AssumeRoleCredentialFetcher,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash

aws cloudformation create-stack --stack-name --region us-east-1 cfn-admin-role-stack \
--template-url https://s3.amazonaws.com/quickstart-examples/samples/cloudformation-stack-ttl/templates/cloudformation-admin-iam.yaml \
--template-url https://s3.amazonaws.com/aws-quickstart/quickstart-examples/samples/cloudformation-stack-ttl/templates/cloudformation-admin-iam.yaml \
--capabilities "CAPABILITY_IAM" "CAPABILITY_AUTO_EXPAND" \
--disable-rollback
--disable-rollback
4 changes: 2 additions & 2 deletions samples/cloudformation-stack-ttl/scripts/deploy-demo-stack.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

aws cloudformation create-stack --stack-name --region us-east-1 demo-stack-ttl \
--template-url https://s3.amazonaws.com/quickstart-examples/samples/cloudformation-stack-ttl/templates/demo-stack-ttl.yaml \
--template-url https://s3.amazonaws.com/aws-quickstart/quickstart-examples/samples/cloudformation-stack-ttl/templates/demo-stack-ttl.yaml \
--capabilities "CAPABILITY_IAM" "CAPABILITY_AUTO_EXPAND" \
--role-arn "<ADD_CLOUDFORMATION_SERVICE_ROLE_ARN_HERE>" \
--disable-rollback
--disable-rollback
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Resources:
Variables:
stackName: !Ref 'StackName'
Handler: "index.handler"
Runtime: "python3.6"
Runtime: "python3.9"
Timeout: "5"
Role: !GetAtt DeleteCFNLambdaExecutionRole.Arn
DeleteStackEventRule:
Expand Down Expand Up @@ -161,7 +161,7 @@ Resources:
status = cfnresponse.FAILED
cfnresponse.send(event, context, status, {}, None)
Handler: "index.handler"
Runtime: "python3.6"
Runtime: "python3.9"
Timeout: "5"
Role: !GetAtt BasicLambdaExecutionRole.Arn

Expand Down
2 changes: 1 addition & 1 deletion samples/session-manager-ssh/session-manager-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL:
Fn::Sub: https://aws-quickstart.s3.amazonaws.com/quickstart-aws-vpc/templates/aws-vpc.template
Fn::Sub: https://aws-quickstart.s3.amazonaws.com/quickstart-aws-vpc/templates/aws-vpc.template.yaml
Parameters:
AvailabilityZones:
Fn::Join:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Resources:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL:
Fn::Sub: https://aws-quickstart.s3.amazonaws.com/quickstart-aws-vpc/templates/aws-vpc.template
Fn::Sub: https://aws-quickstart.s3.amazonaws.com/quickstart-aws-vpc/templates/aws-vpc.template.yaml
Parameters:
AvailabilityZones:
Fn::Join:
Expand Down

0 comments on commit 1bdd2cf

Please sign in to comment.