public MyStack()
    {
        var config  = new Pulumi.Config();
        var siteDir = config.Get("siteDir");

        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs
        {
            Website = new BucketWebsiteArgs
            {
                IndexDocument = "index.html",
            }
        });

        this.BucketName      = bucket.BucketName;
        this.WebsiteEndpoint = bucket.WebsiteEndpoint;

        foreach (var file in Directory.EnumerateFiles(siteDir))
        {
            var name         = Path.GetFileName(file);
            var bucketObject = new Aws.S3.BucketObject(name, new BucketObjectArgs
            {
                Bucket      = bucket.BucketName,
                Source      = new FileAsset(Path.Combine(siteDir, Path.GetFileName(file))),
                Acl         = "public-read",
                ContentType = "text/html",
            });
        }
    }
    public MyStack()
    {
        var config  = new Pulumi.Config();
        var siteDir = config.Get("siteDir");

        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs
        {
            Website = new BucketWebsiteArgs
            {
                IndexDocument = "index.html",
            }
        });

        this.BucketName      = bucket.BucketName;
        this.WebsiteEndpoint = bucket.WebsiteEndpoint;

        var bucketFile   = Path.Combine(siteDir, "index.html");
        var bucketObject = new Aws.S3.BucketObject("index.html", new BucketObjectArgs
        {
            Bucket      = bucket.BucketName,
            Source      = new FileAsset(bucketFile),
            Acl         = "public-read",
            ContentType = "text/html",
        });
    }
Beispiel #3
0
    public MyStack()
    {
        var master = new Aws.GuardDuty.Detector("master", new Aws.GuardDuty.DetectorArgs
        {
            Enable = true,
        });
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
            Acl = "private",
        });
        var myIPSetBucketObject = new Aws.S3.BucketObject("myIPSetBucketObject", new Aws.S3.BucketObjectArgs
        {
            Acl     = "public-read",
            Bucket  = bucket.Id,
            Content = @"10.0.0.0/8

",
            Key     = "MyIPSet",
        });
        var myIPSetIPSet = new Aws.GuardDuty.IPSet("myIPSetIPSet", new Aws.GuardDuty.IPSetArgs
        {
            Activate   = true,
            DetectorId = master.Id,
            Format     = "TXT",
            Location   = Output.Tuple(myIPSetBucketObject.Bucket, myIPSetBucketObject.Key).Apply(values =>
            {
                var bucket = values.Item1;
                var key    = values.Item2;
                return($"https://s3.amazonaws.com/{bucket}/{key}");
            }),
        });
    }
Beispiel #4
0
 public MyStack()
 {
     var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
         ObjectLockConfiguration = new Aws.S3.Inputs.BucketObjectLockConfigurationArgs
         {
             ObjectLockEnabled = "Enabled",
         },
         Versioning = new Aws.S3.Inputs.BucketVersioningArgs
         {
             Enabled = true,
         },
     });
     var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket       = examplebucket.Id,
         ForceDestroy = true,
         Key          = "someobject",
         ObjectLockLegalHoldStatus = "ON",
         ObjectLockMode            = "GOVERNANCE",
         ObjectLockRetainUntilDate = "2021-12-31T23:59:60Z",
         Source = new FileAsset("important.txt"),
     });
 }
    public MyStack()
    {
        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs());

        this.BucketName = bucket.BucketName;

        var bucketFile   = Path.Combine("site", "index.html");
        var bucketObject = new Aws.S3.BucketObject("index.html", new BucketObjectArgs
        {
            Bucket = bucket.BucketName,
            Source = new FileAsset(bucketFile)
        });
    }
Beispiel #6
0
 public MyStack()
 {
     var siteBucket = new Aws.S3.Bucket("siteBucket", new Aws.S3.BucketArgs
     {
     });
     var testFileAsset = new Aws.S3.BucketObject("testFileAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new FileAsset("file.txt"),
     });
     var testStringAsset = new Aws.S3.BucketObject("testStringAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new StringAsset("<h1>File contents</h1>"),
     });
     var testRemoteAsset = new Aws.S3.BucketObject("testRemoteAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new RemoteAsset("https://pulumi.test"),
     });
     var testFileArchive = new Aws.S3.BucketObject("testFileArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new FileArchive("file.tar.gz"),
     });
     var testRemoteArchive = new Aws.S3.BucketObject("testRemoteArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new RemoteArchive("https://pulumi.test/foo.tar.gz"),
     });
     var testAssetArchive = new Aws.S3.BucketObject("testAssetArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new AssetArchive(new Dictionary <string, AssetOrArchive>
         {
             { "file.txt", new FileAsset("file.txt") },
             { "string.txt", new StringAsset("<h1>File contents</h1>") },
             { "remote.txt", new RemoteAsset("https://pulumi.test") },
             { "file.tar", new FileArchive("file.tar.gz") },
             { "remote.tar", new RemoteArchive("https://pulumi.test/foo.tar.gz") },
             { ".nestedDir", new AssetArchive(new Dictionary <string, AssetOrArchive>
                 {
                     { "file.txt", new FileAsset("file.txt") },
                     { "string.txt", new StringAsset("<h1>File contents</h1>") },
                     { "remote.txt", new RemoteAsset("https://pulumi.test") },
                     { "file.tar", new FileArchive("file.tar.gz") },
                     { "remote.tar", new RemoteArchive("https://pulumi.test/foo.tar.gz") },
                 }) },
         }),
     });
 }
Beispiel #7
0
 public MyStack()
 {
     var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
     });
     var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket = examplebucket.Id,
         Key    = "someobject",
         ServerSideEncryption = "AES256",
         Source = new FileAsset("index.html"),
     });
 }
Beispiel #8
0
 public MyStack()
 {
     var examplekms = new Aws.Kms.Key("examplekms", new Aws.Kms.KeyArgs
     {
         DeletionWindowInDays = 7,
         Description          = "KMS key 1",
     });
     var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
     });
     var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket   = examplebucket.Id,
         Key      = "someobject",
         KmsKeyId = examplekms.Arn,
         Source   = new FileAsset("index.html"),
     });
 }
Beispiel #9
0
 public MyStack()
 {
     var defaultBucket = new Aws.S3.Bucket("defaultBucket", new Aws.S3.BucketArgs
     {
     });
     var defaultBucketObject = new Aws.S3.BucketObject("defaultBucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket = defaultBucket.Id,
         Key    = "beanstalk/go-v1.zip",
         Source = new FileAsset("go-v1.zip"),
     });
     var defaultApplication = new Aws.ElasticBeanstalk.Application("defaultApplication", new Aws.ElasticBeanstalk.ApplicationArgs
     {
         Description = "tf-test-desc",
     });
     var defaultApplicationVersion = new Aws.ElasticBeanstalk.ApplicationVersion("defaultApplicationVersion", new Aws.ElasticBeanstalk.ApplicationVersionArgs
     {
         Application = "tf-test-name",
         Bucket      = defaultBucket.Id,
         Description = "application version",
         Key         = defaultBucketObject.Id,
     });
 }