Skip to content

Commit

Permalink
fixing the main template
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilyin committed Jan 21, 2021
1 parent 1ddc592 commit 63df902
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ FUNCTION_DIR := functions
CFN_ARTEFACT_S3_BUCKET ?= ilyiny-sagemaker-demo-artefacts
CFN_TEMPLATE_DIR := cfn_templates
PROJECT_NAME ?= sagemaker-studio-vpc
SM_DOMAIN_NAME ?= sagemaker-demo-domain
SM_USER_PROFILE_NAME ?= demouser-profile
VPC_CIDR ?= 10.2.0.0/16
FIREWALL_SN_CIDR ?= 10.2.1.0/24
NAT_GW_SN_CIDR ?= 10.2.2.0/24
Expand Down Expand Up @@ -42,6 +44,8 @@ deploy: package
--stack-name $(APP_STACK_NAME) \
--parameter-overrides \
ProjectName=$(PROJECT_NAME) \
DomainName=$(SM_DOMAIN_NAME) \
UserProfileName=$(SM_USER_PROFILE_NAME) \
VpcCIDR=$(VPC_CIDR) \
FirewallSubnetCIDR=$(FIREWALL_SN_CIDR) \
NATGatewaySubnetCIDR=$(NAT_GW_SN_CIDR) \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ The solution creates:
- configured `aws cli` with that IAM user or role credentials
- An Amazon S3 bucket in your account in the same region where you deploy the solution

❗ For CloudFormation template deployment you must use the S3 bucket in the same region as you deployment region.
❗ For CloudFormation template deployment you must use the S3 bucket in the same region as your deployment region.
If you need to deploy the solution in different region, you need to create a bucket per region and specify the bucket name in the `make deploy` call.

## CloudFormation stack parameters
- `ProjectName`: **OPTONAL**. Default is `sagemaker-studio-vpc`
- `DomainName`: **OPTIONAL**: SageMaker domain name. Default is `sagemaker-domain-<region>`
- `DomainName`: **OPTIONAL**: SageMaker domain name. Default is `sagemaker-demo-domain-<region>`
- `UserProfileName`: **OPTIONAL**: User profile name for the SageMaker domain. Default is `demouser-profile-<region>`
- `VpcCIDR`: **OPTONAL**. Default is 10.2.0.0/16
- `FirewallSubnetCIDR`: **OPTONAL**. Default is 10.2.1.0/24
Expand Down
29 changes: 12 additions & 17 deletions cfn_templates/packaged.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
AWSTemplateFormatVersion: 2010-09-09
Description: This template creates the infrastructure required to implement and test
SageMaker Studio VPC Mode. It creates a VPC, Subnet, VPC Endpoints, VPC Policies,
and IAM Execution Roles. **WARNING** This template creates AWS Resources in your
account. You will be billed for the AWS resources used if you create a stack from
this template.
Description: Amazon SageMaker Studio secure deployment demo. The deployment creates
all necessary network infrastructure and SageMaker Studio domain.
Parameters:
ProjectName:
Type: String
Default: sagemaker-studio-vpc
DomainName:
Description: SageMaker domain name
Type: String
Default:
Fn::Sub: sagemaker-domain-${AWS::Region}
Default: sagemaker-demo-domain
UserProfileName:
Description: User profile name for the SageMaker domain
Type: String
Default:
Fn::Sub: demouser-profile-${AWS::Region}
Default: demouser-profile
VpcCIDR:
Type: String
Default: 10.2.0.0/16
Expand Down Expand Up @@ -81,16 +76,16 @@ Resources:
Fn::Sub: ${ProjectName}-${AWS::Region}-data
ModelBucketName:
Fn::Sub: ${ProjectName}-${AWS::Region}-models
TemplateURL: https://s3.eu-west-1.amazonaws.com/ilyiny-sagemaker-demo-artefacts/f8515d45bd513b0a30bdbdca648eee06.template
TemplateURL: https://s3.eu-west-1.amazonaws.com/ilyiny-sagemaker-demo-artefacts/3d0d58eb15d519e575bfec9108c84606.template
SageMakerStudio:
Type: AWS::CloudFormation::Stack
DependsOn: IAM
Properties:
Parameters:
DomainName:
Ref: DomainName
Fn::Sub: ${DomainName}-${AWS::Region}
UserProfileName:
Ref: UserProfileName
Fn::Sub: ${UserProfileName}-${AWS::Region}
VpcId:
Fn::GetAtt:
- VPC
Expand All @@ -107,7 +102,7 @@ Resources:
Fn::GetAtt:
- IAM
- Outputs.ExecutionRoleArn
TemplateURL: https://s3.eu-west-1.amazonaws.com/ilyiny-sagemaker-demo-artefacts/d86a37290c0f220ab51858ddbbe54da4.template
TemplateURL: https://s3.eu-west-1.amazonaws.com/ilyiny-sagemaker-demo-artefacts/9df4e5d352738f0ff537059d5599fa82.template
Outputs:
VPCId:
Description: The ID of VPC where SageMaker Studio will reside
Expand Down Expand Up @@ -162,10 +157,10 @@ Outputs:
Value:
Fn::GetAtt:
- SageMakerStudio
- SageMakerStudioDomainId
SageMakerStudioPresignedURL:
Description: Presigned-URL to start the Amazon SageMaker Studio
- Outputs.SageMakerStudioDomainId
UserProfileName:
Description: SageMaker user profile name
Value:
Fn::GetAtt:
- SageMakerStudio
- SageMakerStudioPresignedURL
- Outputs.UserProfileName
12 changes: 6 additions & 6 deletions cfn_templates/sagemaker-studio-vpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Parameters:
DomainName:
Description: SageMaker domain name
Type: String
Default: !Sub sagemaker-domain-${AWS::Region}
Default: sagemaker-demo-domain
UserProfileName:
Description: User profile name for the SageMaker domain
Type: String
Default: !Sub demouser-profile-${AWS::Region}
Default: demouser-profile
VpcCIDR:
Type: String
Default: 10.2.0.0/16
Expand Down Expand Up @@ -73,8 +73,8 @@ Resources:
DependsOn: IAM
Properties:
Parameters:
DomainName: !Ref DomainName
UserProfileName: !Ref UserProfileName
DomainName: !Sub ${DomainName}-${AWS::Region}
UserProfileName: !Sub ${UserProfileName}-${AWS::Region}
VpcId: !GetAtt VPC.Outputs.VPCId
SageMakerStudioSubnetIds: !GetAtt VPC.Outputs.SageMakerStudioSubnetId
SageMakerSecurityGroupIds: !GetAtt VPC.Outputs.SageMakerSecurityGroupId
Expand Down Expand Up @@ -108,10 +108,10 @@ Outputs:
Value: !GetAtt S3.Outputs.ModelBucketName
SageMakerStudioDomainId:
Description: SageMaker Studio domain id
Value: !GetAtt SageMakerStudio.SageMakerStudioDomainId
Value: !GetAtt SageMakerStudio.Outputs.SageMakerStudioDomainId
UserProfileName:
Description: SageMaker user profile name
Value: !Ref UserProfileName
Value: !GetAtt SageMakerStudio.Outputs.UserProfileName



3 changes: 3 additions & 0 deletions cfn_templates/sagemaker-studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,6 @@ Outputs:
SageMakerStudioDomainId:
Description: SageMaker Studio domain id
Value: !GetAtt SageMakerDomainLambdaInvoke.DomainId
UserProfileName:
Description: SageMaker user profile name
Value: !Ref UserProfileName

0 comments on commit 63df902

Please sign in to comment.