Posts Tagged ‘AWS’

Recently restricted an AWS Elastic Beanstalk App so it could only be accessed through a specific DNS host name which was routed through Cloudflare for Security

This parameter is located in archive.xml in \site_content\archive.xml

<binding protocol=”http” bindingInformation=”*:80:subdomain.domain.com” sslFlags=”0″ MSDeploy.sslFlags=”1″ />

GD Star Rating
loading...
GD Star Rating
loading...

When you manipulate items in windows explorer from AWS s3 bucket , it creates folders which then get uploaded to AWS as 0 byte objects. 

You can view these in powershell by using 

Get-S3Object -BucketName “XXXXXX” -keyprefix “documents/XXXXX/XXXXX/” | where-object {$_.Size -eq 0 -and $_.Key -like “XXXX/XXXX/XXXX/12*”}

To remove ( You can only items 1000 at a time ) you can use the below

Remove-S3Object -bucketname “XXXXXX” -KeyCollection (Get-S3Object -BucketName “XXXXXX” -keyprefix “documents/XXXXX/XXXXX/” | where-object {$_.Size -eq 0 -and $_.Key -like “XXXX/XXXX/XXXX/12*”}| select -ExpandProperty Key)

GD Star Rating
loading...
GD Star Rating
loading...
import boto3

def lambda_handler(event, context):
# TODO implement
userID='%%%%%%%' # redundancy user account ID
ec2 = boto3.client('ec2')
volumes = ec2.describe_volumes()
ec2Resource=boto3.resource('ec2')
for volume in volumes['Volumes']:
for attachment in volume['Attachments']:
instance=ec2Resource.Instance(attachment[u'InstanceId'])
instanceName=instance.tags[0][u'Value']
print "Backing up %s in %s" % (volume['VolumeId'], volume['AvailabilityZone'])
break
snapshots = ec2.describe_snapshots(Filters=[{ 'Name': 'owner-id','Values':[userID] }])
for snapshot in snapshots['Snapshots']:
print "Backing up %s in %s" % (instanceName, snapshot['SnapshotId'], volume['AvailabilityZone'])
GD Star Rating
loading...
GD Star Rating
loading...