class InitSource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.InitSource |
Java | software.amazon.awscdk.services.ec2.InitSource |
Python | aws_cdk.aws_ec2.InitSource |
TypeScript (source) | @aws-cdk/aws-ec2 » InitSource |
Extends
Init
Extract an archive into a directory.
Example
declare const myBucket: s3.Bucket;
const handle = new ec2.InitServiceRestartHandle();
ec2.CloudFormationInit.fromElements(
ec2.InitFile.fromString('/etc/nginx/nginx.conf', '...', { serviceRestartHandles: [handle] }),
ec2.InitSource.fromS3Object('/var/www/html', myBucket, 'html.zip', { serviceRestartHandles: [handle] }),
ec2.InitService.enable('nginx', {
serviceRestartHandle: handle,
})
);
Initializer (protected)
super(targetDirectory: string, serviceHandles?: InitServiceRestartHandle[])
Parameters
- targetDirectory
string
- serviceHandles
Init
Service Restart Handle []
Properties
Name | Type | Description |
---|---|---|
element | string | Returns the init element type for this element. |
elementType
Type:
string
Returns the init element type for this element.
Methods
Name | Description |
---|---|
static from | Create an InitSource from an asset created from the given path. |
static from | Extract a directory from an existing directory asset. |
static from | Extract a GitHub branch into a given directory. |
static from | Extract an archive stored in an S3 bucket into the given directory. |
static from | Retrieve a URL and extract it into the given directory. |
static fromAsset(targetDirectory, path, options?)
public static fromAsset(targetDirectory: string, path: string, options?: InitSourceAssetOptions): InitSource
Parameters
- targetDirectory
string
- path
string
- options
Init
Source Asset Options
Returns
Create an InitSource from an asset created from the given path.
static fromExistingAsset(targetDirectory, asset, options?)
public static fromExistingAsset(targetDirectory: string, asset: Asset, options?: InitSourceOptions): InitSource
Parameters
- targetDirectory
string
- asset
Asset
- options
Init
Source Options
Returns
Extract a directory from an existing directory asset.
static fromGitHub(targetDirectory, owner, repo, refSpec?, options?)
public static fromGitHub(targetDirectory: string, owner: string, repo: string, refSpec?: string, options?: InitSourceOptions): InitSource
Parameters
- targetDirectory
string
- owner
string
- repo
string
- refSpec
string
- options
Init
Source Options
Returns
Extract a GitHub branch into a given directory.
static fromS3Object(targetDirectory, bucket, key, options?)
public static fromS3Object(targetDirectory: string, bucket: IBucket, key: string, options?: InitSourceOptions): InitSource
Parameters
- targetDirectory
string
- bucket
IBucket
- key
string
- options
Init
Source Options
Returns
Extract an archive stored in an S3 bucket into the given directory.
static fromUrl(targetDirectory, url, options?)
public static fromUrl(targetDirectory: string, url: string, options?: InitSourceOptions): InitSource
Parameters
- targetDirectory
string
- url
string
- options
Init
Source Options
Returns
Retrieve a URL and extract it into the given directory.