secretKey := os.Getenv("AWS_SECRET_ACCESS_KEY") Expect(secretKey).ToNot(BeEmpty(), "AWS_SECRET_ACCESS_KEY must be set") region := os.Getenv("AWS_REGION") Expect(region).ToNot(BeEmpty(), "AWS_REGION must be set") creds := config.Credentials{ AccessKey: accessKey, SecretKey: secretKey, Region: region, } snapshotID := os.Getenv("EBS_SNAPSHOT_ID") Expect(snapshotID).ToNot(BeEmpty(), "EBS_SNAPSHOT_ID must be set") amiDriverConfig := resources.AmiDriverConfig{SnapshotID: snapshotID} amiUniqueID := strings.ToUpper(uuid.NewV4().String()) amiName := fmt.Sprintf("BOSH-%s", amiUniqueID) amiDriverConfig.Name = amiName amiDriverConfig.VirtualizationType = resources.HvmAmiVirtualization amiDriverConfig.Accessibility = resources.PublicAmiAccessibility amiDriverConfig.Description = "bosh cpi test ami" ds := driverset.NewStandardRegionDriverSet(GinkgoWriter, creds) amiDriver := ds.CreateAmiDriver() ami, err := amiDriver.Create(amiDriverConfig) Expect(err).ToNot(HaveOccurred()) Expect(ami.VirtualizationType).To(Equal(resources.HvmAmiVirtualization))
Expect(region).ToNot(BeEmpty(), "AWS_REGION must be set") creds := config.Credentials{ AccessKey: accessKey, SecretKey: secretKey, Region: region, } dstRegion := os.Getenv("AWS_DESTINATION_REGION") Expect(dstRegion).ToNot(BeEmpty(), "AWS_DESTINATION_REGION must be set") Expect(dstRegion).ToNot(Equal(region), "AWS_REGION and AWS_DESTINATION_REGION should be different") existingAmiID := os.Getenv("AMI_FIXTURE_ID") Expect(existingAmiID).ToNot(BeEmpty(), "AMI_FIXTURE_ID must be set") amiDriverConfig := resources.AmiDriverConfig{} amiUniqueID := strings.ToUpper(uuid.NewV4().String()) amiName := fmt.Sprintf("BOSH-%s", amiUniqueID) amiDriverConfig.Name = amiName amiDriverConfig.VirtualizationType = resources.HvmAmiVirtualization amiDriverConfig.Accessibility = resources.PublicAmiAccessibility amiDriverConfig.Description = "bosh cpi test ami" amiDriverConfig.ExistingAmiID = existingAmiID amiDriverConfig.DestinationRegion = dstRegion ds := driverset.NewStandardRegionDriverSet(GinkgoWriter, creds) amiCopyDriver := ds.CopyAmiDriver() copiedAmi, err := amiCopyDriver.Create(amiDriverConfig) Expect(err).ToNot(HaveOccurred())