Skip to content

Instantly share code, notes, and snippets.

View sudheerchamarthi's full-sized avatar

Sudheer Chamarthi sudheerchamarthi

View GitHub Profile
import boto3
import json
sts=boto3.client('sts')
crossRoleArn = "arn:aws:iam::XX:role/cross"
stsresponse = sts.assume_role(RoleArn=crossRoleArn,RoleSessionName='dynamocross')
src_client = boto3.client('dynamodb', region_name="us-east-1")
dest_client = boto3.client('dynamodb', region_name="us-east-1",aws_access_key_id=stsresponse["Credentials"]["AccessKeyId"],aws_secret_access_key=stsresponse["Credentials"]["SecretAccessKey"],aws_session_token=stsresponse["Credentials"]["SessionToken"])
srcTableName="src"
---
- name: Check if {{ packageName }} is installed
stat: path=/var/www/html2
register: app_path
tags: instal
- name: Install {{ packageName }}
block:
- include: install.yml
when: app_path.stat.exists and ansible_distribution == "Amazon"
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'I am creating 2 s3 buckets and an EC2 instance'
Mappings:
RegionAMI:
us-east-1:
al2: ami-0022f774911c1d690
ubuntu: ami-09d56f8956ab235b3
redhat: ami-0f095f89ae15be883
us-east-2:
import boto3
s3_client = boto3.client('s3')
ec2_client = boto3.client('ec2', region_name="us-east-1")
import pprint
# Use this website for Json - https://jsoneditoronline.org/
# s3_response = s3_client.create_bucket(
# Bucket='mys3bucket-tyuihgfdsrtyuikjhabc',
# )
#
# if s3_response["ResponseMetadata"]["HTTPStatusCode"] == "200":