class InitSource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.InitSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#InitSource |
Java | software.amazon.awscdk.services.ec2.InitSource |
Python | aws_cdk.aws_ec2.InitSource |
TypeScript (source) | aws-cdk-lib » 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. |
Asset(targetDirectory, path, options?)
static frompublic 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.
ExistingAsset(targetDirectory, asset, options?)
static frompublic 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.
GitHub(targetDirectory, owner, repo, refSpec?, options?)
static frompublic 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.
S3Object(targetDirectory, bucket, key, options?)
static frompublic 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.
Url(targetDirectory, url, options?)
static frompublic 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.