Package: cdk-use-cases.custom-cloud9-ssm
custom-cloud9-ssm---All classes are under active development and subject to non-backward compatible changes or removal in any
future version. These are not subject to theSemantic Versioningmodel.
This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.LanguagePackagePythoncdk_use_cases.custom_cloud9_ssmTypescript@cdk-use-cases/custom-cloud9-ssmThis pattern implements a Cloud9 EC2 environment, applying an initial configuration to the EC2 instance using an SSM Document. It includes helper methods to add steps and parameters to the SSM Document and to resize the EBS volume of the EC2 instance to a given size.Here is a minimal deployable pattern definition in Typescript:# Example automatically generated from non-compiling source. May contain errors.newCustomCloud9Ssm(stack,'CustomCloud9Ssm');You can viewother usage examples.Initializer# Example automatically generated from non-compiling source. May contain errors.newCustomCloud9Ssm(scope:Construct,id:string,props:CustomCloud9SsmProps);ParametersscopeConstructidstringpropsCustomCloud9SsmPropsPattern Construct PropsNameTypeDescriptionssmDocumentProps?ssm.CfnDocumentPropsOptional configuration for the SSM Document.cloud9Ec2Props?cloud9.CfnEnvironmentEC2PropsOptional configuration for the Cloud9 EC2 environment.Pattern PropertiesNameTypeDescriptionec2Roleiam.RoleThe IAM Role that is attached to the EC2 instance launched with the Cloud9 environment to grant it permissions to execute the statements in the SSM Document.Pattern Methods# Example automatically generated from non-compiling source. May contain errors.publicaddDocumentSteps(steps:string):voidDescriptionAdds one or more steps to the content of the SSM Document.Parametersstepsstring: YAML formatted string containing one or more steps to be added to themainStepssection of the SSM Document.# Example automatically generated from non-compiling source. May contain errors.publicaddDocumentParameters(parameters:string):voidDescriptionAdds one or more parameters to the content of the SSM Document.Parametersparametersstring: YAML formatted string containing one or more parameters to be added to theparameterssection of the SSM Document.# Example automatically generated from non-compiling source. May contain errors.publicresizeEBSTo(size:number):voidDescriptionAdds a step to the SSM Document content that resizes the EBS volume of the EC2 instance. Attaches the required policies toec2Role.Parameterssizenumber: size in GiB to resize the EBS volume to.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:Cloud9 EC2 environmentCreates a Cloud9 EC2 environment with:T3.large instance type.SSM DocumentCreates an SSM Document with:A step that installs jq.A step that resizes the EBS volume of the EC2 instance to 100 GiB.ArchitectureOther usage examplesUsing default configuration and adding steps# Example automatically generated from non-compiling source. May contain errors.import{CustomCloud9Ssm}from'@cdk-use-cases/custom-cloud9-ssm';//Defineastepthatinstallsboto3constboto3Step=`-name:InstallBoto3action:aws:runShellScriptinputs:runCommand:-"#!/bin/bash"-sudopipinstallboto3`//CreatethecustomenvironmentletcustomCloud9=newCustomCloud9Ssm(this,'CustomCloud9Ssm')//AddyoursteptothedefaultdocumentconfigurationcustomCloud9.addDocumentSteps(boto3Step)Providing props for the SSM Document and resizing the EBS volume# Example automatically generated from non-compiling source. May contain errors.import{CustomCloud9Ssm,CustomCloud9SsmProps}from'@cdk-use-cases/custom-cloud9-ssm';constyaml=require('yaml')//Definethecontentofthedocumentconstcontent=`schemaVersion:'2.2'description:BootstrapCloud9EC2instancemainSteps:-name:InstallBoto3action:aws:runShellScriptinputs:runCommand:-"#!/bin/bash"-sudopipinstallboto3`//SpecifytheconfigurationfortheSSMDocumentconstcloud9Props:CustomCloud9SsmProps={ssmDocumentProps:{documentType:'Command',content:yaml.parse(content),name:'MyDocument'}}//CreatethecustomenvironmentletcustomCloud9=newCustomCloud9Ssm(this,'CustomCloud9Ssm',cloud9Props)//AddasteptoresizetheEBSvolumeto50GBcustomCloud9.resizeEBSTo(50)© Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.