Example #1
0
        public void ConfigureTemplateExpiry()
        {
            // Set up the lifecycle rules for the bucket where we store Cloud Formation templates
            var cloudOptions = new CloudOptions();
            var credentials = AmbientCredentials.GetCredentials();
            var s3Client = AWSClientFactory.CreateAmazonS3Client(credentials);
            var storageService = new StorageService(s3Client, new S3PathParser());

            storageService.CreateExpirationRule(
                cloudOptions.ConfigurationTemplateBucket,
                Conventions.ConfigurationTemplateBucketPrefix,
                7,
                "Cloud Formation Template Cleanup"
                );
        }
        private static BootstrapData BootstrapApplication()
        {
            // If we're not on EC2, then we'll not even try bootstrapping the application.
            if (!IsEc2)
            {
                return null;
            }

            // Uses ambient AWS credentials, probably from an IAM role.
            // This should be exactly the same as just creating the clients without passing the credentials.
            // It is left explicit to guarantee the same algorithm is used to get credentials here as it is
            // in Startup.Autofac.cs.
            AWSCredentials credentials = AmbientCredentials.GetCredentials();
            IAmazonEC2 ec2Client = AWSClientFactory.CreateAmazonEC2Client(credentials);
            IAmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client(credentials);

            var instanceService = new InstanceService(ec2Client);
            var storageService = new StorageService(s3Client, new S3PathParser());
            var metadataService = new MetadataService();

            var bootstrapper = new ApplicationBootstrapper(instanceService, storageService, metadataService);
            return bootstrapper.BootstrapApplication();
        }
 public void SetUp()
 {
     S3ClientMock = new Mock<IAmazonS3>();
     PathParserMock = new Mock<IS3PathParser>();
     StorageService = new StorageService(S3ClientMock.Object, PathParserMock.Object);
 }
 public void SetUp()
 {
     AWSCredentials credentials = AmbientCredentials.GetCredentials();
     S3Client = AWSClientFactory.CreateAmazonS3Client(credentials);
     StorageService = new StorageService(S3Client, new S3PathParser());
 }